Need help revising the format of the "Rename" scripts I've been running. Essentially, I'm using the earliest date to then copy it over to the Date Modified Field (which still works) and then use that date to rename the file. It was working but I'm not sure if a version update rendered it unusable or not. I know it says it cannot find it, however it finds it for the Date Modified update.
exiftool -ver
12.96
JPG Photos
Update Date Modified Field *Works
exiftool -r "-filemodifydate<datetimeoriginal" DIR
Rename File *Gives error "The system cannot find the file specified."
exiftool -r -d %Y%m%d_%H%M%S '-filename<${DateTimeOriginal}000%-c.%e' '-filename<${SubSecDateTimeOriginal}${SubSecDateTimeOriginal#;$_ = /(\.\d+)/ ? sprintf('%.3d',$1*1000) : '000'}%-c.%e' DIR
MOV Videos
Update Date Modified Field *Works
exiftool -r "-filemodifydate<CreationDate" DIR
Rename File *Gives error "The system cannot find the file specified."
exiftool -r -d %Y%m%d_%H%M%S '-filename<${CreationDate}000%-c.%e' DIR
Thanks in advance
What OS/command line? I'm guessing Mac/Linux because your working commands would fail on Windows due to illegal filename characters.
The first command has a quoting problem. You are using single quotes inside single quotes. The sprintf part and the 0s after that should need double quotes. Try
sprintf("%.3d",$1*1000) : "000"}
I have been using Windows 11 and it was working before. I rebooted my computer and updated that string with the double quotes but still receive the same error.
Are you using CMD or Powershell? I can't help you if you are using PS. It's quoting rules are completely different from any other command line.
Your working command should not work at all on Windows because they don't remove the colons in the dates.
Fixing the quotes, your first command works in CMD, renaming my test file to 20240113_120000550.jpg based upon the time stamp of 2024:01:13 12:00:00.55-08:00
C:\>exiftool -progress -r -d %Y%m%d_%H%M%S "-filename<${DateTimeOriginal}000%-c.%e" "-filename<${SubSecDateTimeOriginal}${SubSecDateTimeOriginal#;$_ = /(\.\d+)/ ? sprintf('%.3d',$1*1000) : '000'}%-c.%e" Y:\!temp\x\y\Test4.jpg
======== Y:/!temp/x/y/Test4.jpg [1/1]
'Y:/!temp/x/y/Test4.jpg' --> 'Y:/!temp/x/y/20240113_120000550.jpg'
1 image files updated
Same with the second command after fixing the quotes
C:\>exiftool -r -d %Y%m%d_%H%M%S "-filename<${CreationDate}000%-c.%e" -progress Y:\!temp\x\y\Test.mp4
======== Y:/!temp/x/y/Test.mp4 [1/1]
'Y:/!temp/x/y/Test.mp4' --> 'Y:/!temp/x/y/20240113_120000000.mp4'
1 image files updated
I am using CMD. That was the fix, not sure how it worked before, but I appreciate you helping me out! Thank you.