TransWikia.com

ExifTool command (Windows 10) to move files to a separate directory if the modified-date is later than the date-taken

Photography Asked on April 22, 2021

I’m very new to this, please be gentle. My aim is to identify, and separate, original (unamended) photos, from several thousands of amended photos. Often with the same name but different directory.

Thought I should try to identify the amended files – presumably where these two dates differed? – and label them or move them away to another directory.

I’ve tried to formulate a command by copying bits of various advice on this site:

exiftool -if "/^$datetimeoriginal/ !~ $filemodifydate -r." 

is as far as I got but I do not understand why datetimeoriginal had different symbols surrounding it compared to filemodifydate, and I don’t know if I should use NOT instead of !~.

Please can you help formulate a command line for me (Windows 10), which identifies the amended image files and also tags, moves or renames them.

One Answer

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.

Correct answer by StarGeek on April 22, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP