ExifTool on Windows: move images whose file modified date is later than DateTimeOriginal
Asked 3/26/2021
4 views
2 answers
0
I want to use ExifTool on Windows 10 to separate edited images from original photos in a large collection. My idea is to treat a file as likely amended if its filesystem modified date is later than the EXIF DateTimeOriginal value, then move those files into another folder. What ExifTool command should I use to compare these two dates recursively and move matching files? Also, is there anything special to watch out for when comparing FileModifyDate and DateTimeOriginal?
Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0
Photography Stack Exchange contributor
5y ago
2 Answers
5
Try this command:
exiftool -d "%Y:%m:%d %H:%M:%S" -r -if "$FileModifyDate gt $DateTimeOriginal" -directory=/path/to/modified/ /path/to/source
This checks the FileModifyDate to see if it is greater than (string comparison) the DateTimeOriginal. If so, it will move it to /path/to/modified/
The -d (-dateFormat) option is needed because the FileModifyDate will always include the time zone of the computer, e.g. 2021:03:26 12:00:00-07:00, while DateTimeOriginal does not include a time zone, e.g. 2021:03:26 12:00:00, and that would cause FileModifyDate to be greater than DateTimeOriginal if the time stamps were otherwise identical.
If you need to deal with filename collisions, you can add a copy number to any additional files by switching from -Directory to -Filename and adding some percent tokens which are detailed in the -w (-TextOut) option. In this case, any additional copies will have an UnderscoreNumber added to the filename.
exiftool -d "%Y:%m:%d %H:%M:%S" -r -if "$FileModifyDate gt $DateTimeOriginal" -Filename=/path/to/modified/%f%+c.%e /path/to/source
The quoting for this command assumes you're using CMD. If you're using PowerShell, I believe you need to swap the double quotes for single quotes to prevent PS from assuming the dollar sign is the start of a variable.
Originally by user37960. Source · Licensed CC BY-SA 4.0
user37960
5y ago
0
Generated from our catalog & community — verify before relying on it.
You can do it with ExifTool’s -if condition and write a new directory for matching files:
exiftool -d "%Y:%m:%d %H:%M:%S" -r -if "$FileModifyDate gt $DateTimeOriginal" -directory=/path/to/modified/ /path/to/source
What it does:
-rscans subfolders recursively.-if "$FileModifyDate gt $DateTimeOriginal"keeps only files whose file modified date is later than the EXIF capture date.-directory=...moves matching files to the target folder.-d "%Y:%m:%d %H:%M:%S"is important becauseFileModifyDateusually includes a time zone, whileDateTimeOriginaloften does not. Formatting both avoids false matches when the timestamps are otherwise the same.
Notes:
- This is a practical way to find likely edited files, but it is not perfect: some files may have later modified dates for reasons other than image edits.
- If you may get filename collisions in the destination folder, use a filename-based renaming approach instead of only setting
-directory, so duplicates can get unique copy numbers.
Recommended products
UniqueBot
AI5y ago
Your Answer
Related Questions
Why does ExifTool shift times by 1 hour when copying FileModifyDate to EXIF dates around BST/GMT?
How can I set video file dates to match their embedded metadata on macOS using ExifTool?
How can I set a file’s modified date to the photo’s original capture date with ExifTool?
How can I batch-set EXIF date fields from a JPEG file's modified date?
How can I batch rename photos by date and check for out-of-order timestamps?