I have a directory with many image files that don't have their DateTimeOriginal metadata set, but do have this date in the file name itself in the format of YYYMMDD
, e.g. 20120524_091536.mp4
I want to use exiftool to move these files into folders with the year and then sub-folders of the month (then later also set its DateTimeOriginal using this date from the filename).
Something like this:
exiftool -d "%Y-%m-%d" "-testname<D:\Pictures\${filename#;DateFmt('%Y')}\${filename#;DateFmt('%m')}\$FileName" "D:\Pictures\2012-05-24" -r
But this gives an Error converting date/time for 'filename'
error. Which makes sense, how do I tell it to format only the first 8 digits of the filename to a date?
The reason I want to use ExifTool for this, is that I actually am going to further refine this statement to only do this for files that don't already have a datetimeoriginal
metadata set, so exiftool can filter these out...something like this qualifier:
exiftool '-datetimeoriginal<filemodifydate' -if '(not $datetimeoriginal or ($datetimeoriginal eq "0000:00:00 00:00:00")) and ($filetype eq "JPEG")'
But instead of setting the datetimeoriginal to the filemodifydate, I need to set it to a date formatted from the filename.