Trying to switch to Exiftool from jhead to rename more filetypes other than jpg & jpeg.
Whats the script for exiftool to convert from jhead:
jhead -n"%Y_%m_%d-newname-%04i" *.jpg
output: 2019_10_05-newname-0001.jpg
*.jpg as multiple files
Trying to switch to Exiftool from jhead to rename more filetypes other than jpg & jpeg.
Whats the script for exiftool to convert from jhead:
jhead -n"%Y_%m_%d-newname-%04i" *.jpg
output: 2019_10_05-newname-0001.jpg
*.jpg as multiple files
Jhead's -n option appears to read the DateTimeOriginal tag for the timestamp so you would be doing a tag copy from DateTimeOriginal to Filename. You would use the -d (dateFormat) option to format the timestamp to your pattern and exiftool uses about the same format as JHead (see here for exiftool date formatting variables).
Exiftool has the FileSequence tag that will holds the file count. In order to pad that out to four places, you have to use the Advanced formatting feature and a bit of perl code.
The end result would be something like this:
Windows:
exiftool -d "%Y_%m_%d" "-Filename<${DateTimeOriginal}-newname-${FileSequence;$_=sprintf('%04d', $_ )}.%e" <FilesOrDirs>
Mac/Linux:
exiftool -d '%Y_%m_%d' '-Filename<${DateTimeOriginal}-newname-${FileSequence;$_=sprintf("%04d", $_ )}.%e' <FilesOrDirs>
Replace Filename with Testname to test the command without actually renaming any files. Swap single/double quotes if running Mac/Linux to avoid bash interpreting parts of the command as variables. Add -r (recurse) option to recurse into subdirectories.
Warning: [minor] The ExtractEmbedded option may find more tags in the movie data - /User/name/Pictures/Videos/Vid001.MP4 Warning: No writable tags set from /User/name/Pictures/Videos/Vid001.MP4
– jcron13
Nov 06 '19 at 22:20
CreateDate for those. If that doesn't work, run exiftool -s FILE.mp4 to see the tags in the file and pick one that would work for you.
– StarGeek
Nov 06 '19 at 22:48
cmd shell, see: Escape double quotes in parameter ([so])
– scottbb
Nov 07 '19 at 03:06
jhead -n"%Y_%m_%d-newname-%04i" *.jpg .It has worked fine a couple weeks ago, I’m not sure whats causing this. Can Exiftool replace quotation marks by removing it for affected files. Also Exiftool is unable to find the Directory of a folder when executing the command shown in this post. I’m thinking macOS file permissions is causing it from a recent update
– jcron13
Jul 17 '20 at 11:56
exiftool -r '-Filename<${Filename;s/“|”//g}' /path/to/files/ Make sure the quotes don't get replaced with the Smart Quotes when you type that in.
– StarGeek
Jul 17 '20 at 15:22