This PowerShell script helps fix incorrect dates for WhatsApp images in Google Photos by extracting the original date and time from filenames and updating the file metadata.
When WhatsApp images are backed up, transferred, or restored, the original date and time may be lost. Google Photos often relies on file metadata to organize images, leading to incorrect dates being displayed if the metadata is overwritten. This script addresses the issue by extracting the correct dates from the file names and updating the metadata.
- Supports common WhatsApp image filename formats:
IMG-YYYYMMDD-WA####.jpg
IMG_YYYYMMDD_HHMMSS.jpg
- Extracts the correct date and time from filenames.
- Updates the file's creation and modification metadata to reflect the original date.
- Windows PowerShell (pre-installed on most Windows systems).
- Exiftools - Already present in the repo.
-
Prepare Your Files
- Place all WhatsApp images with incorrect dates into a single folder.
- Ensure the filenames follow WhatsApp’s standard naming conventions.
-
Download the Repo
- Save the repo & extract all the files (
FixWhatsAppDates.ps1
& exiftools) to the same folder.
- Save the repo & extract all the files (
-
Run the Script
- Open PowerShell.
- Navigate to the folder containing the script and your media files:
cd "C:\path\to\your\folder"
- Execute the script:
.\FixWhatsAppDates.ps1
-
Verify the Changes
- Check the file properties to confirm the updated creation and modification dates.
- Re-upload the files to Google Photos to reflect the correct dates.
- Default Time: If the filename does not specify a time, the default time of 10:00:00 is used.
- File Backup: Always back up your files before running the script.
Feel free to submit issues or pull requests to improve the script.