by Luuk » Thu May 06, 2021 5:10 pm
Its unfortunate, but that exiftool command will only conduct .heic files, if having the metadata $DateTimeOriginal.
I wish there can be some universal metadata date for all file-types, but the exiftool also grants to specify priorities like...
exiftool -q -m -ext jpg -ext heic -ext mov -d "%Y-%m-%d %H-%M-%S" -if "$Filename !~ /(19|20)\d{2}-\d\d-\d\d \d\d-\d\d-\d\d/"
-TESTname"<${Filename;s/\.[^.]+$//} from $MetadataDate.${Filename;s/.*\.//}"
-TESTname"<${Filename;s/\.[^.]+$//} from $ModifyDate.${Filename;s/.*\.//}"
-TESTname"<${Filename;s/\.[^.]+$//} from $CreateDate.${Filename;s/.*\.//}"
-TESTname"<${Filename;s/\.[^.]+$//} from $DateTimeOriginal.${Filename;s/.*\.//}" "FolderPath"
So if making all of that onto one line, with spaces before each -TESTname, this how it conducts on the command line...
First, it looks to see if any YYYY-MM-DD HH-MM-SS is already in the filenames, so then knowing to leave them alone.
Then it looks for $MetadataDate to create the new name
Then it looks for $ModifyDate to create the new name (so if this exists, it overrides $MetadataDate)
Then it looks for $CreateDate to create the new name (so if this exist, it overrides the first two)
Then it looks for $DateTimeOriginal to create the new name (so if this exists, it overrides them all)
You can add more $Metadata if you discover anything to be more reliable, but remember the most reliable ones always go last. Its unfortunate, but Im not expert with the metadata, so not knowing if that order is really the best for your file-types. But there is an exiftool forum, with experts who can probably know the best order for your $Metadata.
You might even need a different order for each file-type, but I think this really just depends on the users files. There is also -r to recurse, and -TESTname just presents previews, and Im just pretending that you want to append from Date to your names. If you wanted to make names with only dates, you might add something like %-3c, so then exiftool would append -001, -002, etc to create unique names if any of the files have the exact same date and times.