Boy this is a powerful tool! But my programming skills do not help me building this command...
I'm clearing my Galleries from here and there and moving the image and video files (mostly jpg, mp4, mov) to organized folder structure.
At the moment I am using not-that-sophisticated command like this:
exiftool -d "D:/mydata/pictures/"%Y/%Y-%m "-directory<datetimeoriginal" . -r
This works perfectly as long as DateTimeOriginal data exists. If it does not, I want to use CreationDate, then CreateDate, then FileCreateDate.
Q1: How to add those fallbacks into this same command?
Next problem comes with duplicate file names. Very often the files to be moved, already exist in the destination folder, giving me an error message:
Error: 'D:/mydata/pictures/2019/2019-09/IMG_0374.JPG' already exists - ./source2iPhone2019/IMG_0374.JPG
Q2: How do REMOVE the duplicate files from the SOURCE (or in the destination and then moving the file from source to destination)?
Duplicate file = same filename + size (expecting that file size is the best way to check the files are identical)
Q3: How to rename the file, if only the filename is same but the size is different? The file shall be moved to its destination with filename added with _1, _2 etc.
Thanks in advance.
Quote from: julleboy on May 05, 2021, 03:31:45 AMThis works perfectly as long as DateTimeOriginal data exists. If it does not, I want to use CreationDate, then CreateDate, then FileCreateDate.
Q1: How to add those fallbacks into this same command?
See Example 12 (https://exiftool.org/filename.html#ex12) on the Writing "FileName" and "Directory" tags (https://exiftool.org/filename.html) page. Just duplicate the
"-directory<datetimeoriginal" part with the other tags you want to use, placing the lowest priority first and the highest priority last.
QuoteQ2: How do REMOVE the duplicate files from the SOURCE (or in the destination and then moving the file from source to destination)?
Duplicate file = same filename + size (expecting that file size is the best way to check the files are identical)
Q3: How to rename the file, if only the filename is same but the size is different? The file shall be moved to its destination with filename added with _1, _2 etc.
Exiftool only processes one file at a time and can't compare data between two files, at least, not without some extremely messy tricker which boils down to writing a Perl script to embed in the command. Also, it cannot delete a file.
If you want to copy the duplicates, can change your command to use
Filename instead of
Directory and add the
%c token which will add a copy number
exiftool -d "D:/mydata/pictures/%Y/%Y-%m/%%f%%-c.%%e" "-directory<datetimeoriginal" . -rAlternatively, you could use a program like DupeGuru (https://dupeguru.voltaicideas.net/) to remove duplicate before hand.