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
Photography Stack Exchange is a question and answer site for professional, enthusiast and amateur photographers. It only takes a minute to sign up.
Sign up to join this communityTrying 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