From the SyncGallery team

How to restore a photo timeline from filenames

A photo can survive several phones, memory cards, cloud downloads, and backup restores while its original capture date does not. Sometimes the last reliable clue is still sitting in the filename.

A disordered collection of photos becoming an organized chronological gallery timeline

A gallery is not only a grid of files. It is a timeline. To put every photo and video in the right place, the gallery needs a reliable date.

For a camera photo, that date usually comes from EXIF metadata stored inside the file. For a video, it may come from metadata inside the video container. Android also keeps dates in its media database, and the filesystem has its own modified timestamp.

The problem is that these dates do not always survive a long journey.

  • A messenger or export tool may remove EXIF metadata.
  • A file copied through several devices may receive a new modified date each time.
  • A restored folder may make years of photos look as if they were all created on the restore day.
  • Two gallery apps may use different date fields and show the same files in a different order.

The image is still fine, but it appears in the wrong month or year. A holiday photo from 2019 can suddenly sit beside today's screenshots.

The filename may still know the answer

Many cameras and apps put the capture date directly in the filename. Even if the embedded metadata disappears and the file timestamp changes, a name such as IMG_20190715_143022.jpg still contains July 15, 2019 at 14:30:22.

SyncGallery recognizes several filename structures:

  • IMG_20230415_143022.jpg
  • Screenshot_2023-04-15-14-30-22.png
  • 20230415_143022.jpg
  • 2023-04-15_14-30-22.jpg
  • 2023-04-15 14.30.22.jpg

The prefix and extension can vary where the pattern allows it. SyncGallery parses the date strictly, so an impossible value such as month 19 is rejected rather than silently converted into another date.

Filename timestamps normally do not include a time zone. SyncGallery interprets them using the phone's current local time zone.

How SyncGallery chooses a date

The Update Date/Time screen checks three sources for each selected item:

  1. EXIF or embedded media metadata.
  2. A recognized date in the filename.
  3. The date currently exposed for the file by Android.

If an EXIF capture date exists, SyncGallery prefers it. If EXIF is missing but the filename contains a recognized date, the filename becomes the detected source. The file date is the fallback.

Every row shows the detected values and their source. Nothing is written just because SyncGallery found a date. You decide which files to update and can change the proposed value before applying it.

The SyncGallery Update Date and Time screen showing EXIF, Filename, and File date choices
The Update Date/Time screen shows the available date sources for every selected file.

Restore the timeline step by step

1. Select the affected files

Open the Gallery, select the photos or videos that appear in the wrong place, open the selection menu, and choose Update Date/Time. You can open the same action for one item from its preview.

Start with a small batch. It is much easier to verify two or three corrected files before changing an entire archive.

2. Review the detected source

The screen shows the current date, filename, preview, and source choices for each item. When SyncGallery recognizes a filename pattern, the pattern is displayed below the filename.

You can tap Filename on an individual row. For a larger batch, select the relevant rows, tap Set Date, and choose Use filename date.

The filter button can narrow the list by EXIF date, filename date, file date, or manually set date. This is useful when one folder contains both normal camera photos and imported files with missing metadata.

3. Check the proposed dates

Do not rely on the filename only because it contains digits. Confirm that the parsed day and time make sense for the event.

If a filename cannot be recognized, Use filename date does not replace that item's proposed date. Review or deselect it before applying the batch. You can set a date manually instead, or use Use earliest date to choose the earliest available value from EXIF, filename, and file date.

4. Choose where the date should be written

When you tap Apply, SyncGallery asks which date fields to update. Different apps read different fields, so the right choices depend on your goal.

  • MediaStore Date Taken controls how Android gallery apps commonly sort the item on this device.
  • EXIF DateTimeOriginal, EXIF DateTime, and EXIF DateTimeDigitized store dates inside supported image files.
  • MP4 Creation Time stores the value inside supported video files.
  • File Date Modified updates the filesystem timestamp when Android and the storage location allow it.

For a portable repair, write the value into the file metadata when the format supports it. A MediaStore-only correction can repair sorting on the current phone, but that database value may not follow the file when it is copied elsewhere.

Android may ask for permission before SyncGallery changes files or MediaStore entries. Some storage locations limit which fields can be updated, so review the result message after the operation finishes.

After a successful update, SyncGallery refreshes its date information and the affected items can move to their corrected positions in the timeline. Other gallery apps may need a media rescan or a short wait before they show the new order.

A practical example

Imagine an archive copied from an old phone to a computer, then to a NAS, and finally back to Android. Every file now has the same modified date: the day of the final copy. EXIF is missing, but the names still look like this:

text IMG_20190715_143022.jpg IMG_20190715_143118.jpg VID_20190715_144005.mp4

Select those files, choose Use filename date, review the proposed values, and write the appropriate media fields. Instead of appearing together on the restore day, they return to their original positions on July 15, 2019, in capture order.

Important safety notes

  • There is no automatic undo. You can change a date again, but SyncGallery does not save the previous metadata values as a restore point.
  • Test one file first. Check it in SyncGallery and another gallery app before processing a large archive.
  • Keep a backup. Metadata updates modify the selected files when embedded fields are enabled.
  • A filename is evidence, not proof. A file renamed with the wrong date will produce the wrong result.
  • Check the time zone. A filename without a zone is interpreted in the phone's local time zone.

This feature cannot recover information that no longer exists anywhere. But when the timestamp survived inside a structured filename, it can turn a broken archive back into a useful photo timeline.

For a detailed explanation of every source and write option, see the SyncGallery Date & Time guide.

SyncGallery

Try SyncGallery

A gallery app with cloud sync you control, for Android.

Get it on Google Play
More from the blogBack to top