3

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.

4

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.

4
  • Just tested it with 8 files and it works great; thank you so much !!
    – Bella
    Mar 26 at 19:16
  • Hi again. Had some problems, tried my best, but hope you can help. FileModifyDate has seconds / DateTimeOriginal has no seconds; so dates not accurately compared. (Tried "-DateTimeOriginal<DateTimeOriginal" in various places, no success). Some Date Modified exactly 1 hour later than Date taken. Errors returned on duplicate file names (moving files from subdirectories to one directory), can these be serialised rather than skipped?
    – Bella
    Apr 4 at 12:52
  • I don't know what you mean by serialised. And it would be extremely strange to have a DateTimeOriginal without seconds. But in that case you can remove the :%S to remove seconds from the comparison and only compare on the minute level. You can add a copy number to the filenames, edited the above.
    – StarGeek
    Apr 4 at 15:09
  • Great, that's exactly what I meant, the number adding works fine, thanks. Any ideas how to tackle the files where the modify date is exactly one hour later than the taken date?
    – Bella
    Apr 4 at 17:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.