I was batch-optimizing a photo/video library for sharing when I noticed two things immediately: the optimized files had lost useful metadata, and Finder was suddenly convinced everything was captured “today”. After chasing it for a bit, the fix turned out to be straightforward: copy metadata from the originals back onto the optimized files, then align the optimized files’ filesystem timestamps to the capture/recording time.
This guide shows the exact workflow I use on macOS with exiftool.
What we’re fixing
When you compress, resize, or re-encode media, you usually end up with:
Missing or altered metadata (EXIF/XMP/IPTC for photos, QuickTime dates for videos).
Wrong filesystem timestamps (so Finder sorts by “today” instead of the real capture date).
The goal is to keep your originals untouched as the source of truth, and make the optimized copies look like the originals to both metadata readers and Finder.
Prerequisites
Install ExifTool:
bash
brew install exiftool
Set up your folders like this (optimized files in a subfolder, with matching basenames):
-TagsFromFile "../%f.%e" is the key: %f is the filename without extension, and %e is the extension. So optimized/DSC03873.JPG pulls tags from ../DSC03873.JPG.
Once this finishes, your optimized photos should have the same embedded metadata as the originals. Next we’ll fix what Finder uses for date-based sorting.
Step 2 — Make Finder dates match the capture time
Finder (and a lot of tooling) relies on filesystem timestamps. After optimization, those timestamps usually reflect when the optimized file was generated. I set the optimized file’s modification time to match DateTimeOriginal.
bash
# Working directory: /path/to/media/optimizedcd"/path/to/media/optimized"
exiftool -overwrite_original -P "-FileModifyDate<DateTimeOriginal" *.[Jj][Pp][Gg]
At this point, both the embedded capture date and the file modification time should line up with the original photo.
You’re looking for DateTimeOriginal (and optionally Make/Model) to match between the two, and for the optimized file’s FileModifyDate to match its DateTimeOriginal.
Part 2 — Videos (MP4)
Step 1 — Copy metadata from originals to optimized videos
For MP4s, I start by copying what’s writable from the original container (QuickTime dates plus any XMP/IPTC that exists).
If your optimized videos already have the right recording date after this step, skip the XML sidecar step and go straight to syncing filesystem timestamps.
Step 2 (Optional) — Override CreateDate using XML sidecars
Some cameras export sidecar files like C0342M01.XML with a CreationDate value that’s more trustworthy than what ends up in the MP4. If you have those XML files and your video dates still look wrong, this loop extracts CreationDate from each sidecar and writes it into the matching optimized MP4.
bash
# Working directory: /path/to/media/optimizedcd"/path/to/media/optimized"for xml_file in ../*M01.XML; do
video_opt="./$(basename "$xml_file" M01.XML).mp4"
creation_date="$(grep 'CreationDate value=' "$xml_file" | sed 's/.*value=\"\\([^\"]*\\)\".*/\\1/')"if [ -n "$creation_date" ] && [ -f "$video_opt" ]; then
exiftool -overwrite_original -P "-CreateDate=$creation_date""$video_opt"fidone
This keeps the mapping simple: ../C0342M01.XML updates ./C0342.mp4. If your naming differs, adjust the video_opt line accordingly.
Step 3 — Make Finder dates match the recording time
Now align the optimized videos’ filesystem modification time to the embedded CreateDate:
bash
# Working directory: /path/to/media/optimizedcd"/path/to/media/optimized"
exiftool -overwrite_original -P "-FileModifyDate<CreateDate" *.[Mm][Pp]4
If the times look “off by a couple hours”, it’s usually timezone display. ExifTool will show the stored timezone offset (when present); Finder may render the same moment in your system timezone.
Troubleshooting
If ExifTool prints “File not found” warnings, it almost always means the optimized/ file doesn’t have an exact name match in the parent folder. Double-check that you’re running from optimized/ and that basenames and extensions match.
If Finder still shows “today”, make sure you ran the filesystem timestamp step (-FileModifyDate<...). Also note that Finder has multiple date columns; this workflow intentionally targets embedded capture/recording metadata plus filesystem modification time.
Conclusion
If you follow the steps above, you end up with optimized photos and videos that keep the important embedded metadata from the originals, and that sort correctly in Finder because their filesystem modification times match the real capture/recording dates. You now have a repeatable ExifTool workflow for syncing metadata from a parent “originals” folder into an optimized/ folder, including the optional XML-sidecar override for MP4 CreateDate.
Let me know in the comments if you have questions, and subscribe for more practical development guides.