Hello.
I would like to add oldestdatetime tag value as a prefix to a whole folder and subfolders.
I want to keep everything else unmodified, including creation/modification filetime.
I think it would be something like this
exiftool '-filename <${OldestDateTime}_%f.%e' -P -r -overwrite_original DIR
Is that right? Im not confident about the _%f.%e part
thank you
Use Testname instead of Filename to see if the results are what you want. If it looks correct, then you can use Filename.
%f is the base name of the original file and %e is the original extension of the file. So %f.%e together is the full original filename. Alternatively, you can use %F (capital F), which is the same as the combined %f.%e. See the -w (-TextOut) option (https://exiftool.org/exiftool_pod.html#w-EXT-or-FMT--textOut) for full details on the percent variables.
You can drop the -overwrite_original option (https://exiftool.org/exiftool_pod.html#overwrite_original) from this command as renaming a file doesn't do any editing of the embedded data.
I'm assuming that you're using a -d (-dateFormat) option (https://exiftool.org/exiftool_pod.html#d-FMT--dateFormat) in your actual command, because, IIRC, OldestDateTime is going to give you a standard date string which includes colons, which are illegal in a filename on Windows. If your on Mac/Linux, I think it might work (not sure on that) but you would have problems if the file is ever moved to a Windows file system. See the Writing "FileName" and "Directory" tags -> Notes (https://exiftool.org/filename.html#Notes) page.
Great. Thank you.
C:\Users\Emilio>exiftool -d %Y%m%d_%H%M%S%%-c-%%f%%e "-testname<CreateDate" DIR
And yet another question. What would be the syntax of a blank space? I would like to have a blank space beetween the prefix date and the original file name.
It should be after the -c (That creates a number if there is a repeated name), but I cant figure how to insert a blank space.
Tried C:\Users\Emilio>exiftool -d %Y%m%d_%H%M%S%%-c -%%f%%e "-testname<CreateDate" DIR
and also C:\Users\Emilio>exiftool -d %Y%m%d_%H%M%S%%-c%% -%%f%%e "-testname<CreateDate" DIR
without success
edit: forgot to add -r to do all files in all subfolders, and -P so no changes are made in the tags
Quote from: smaiderman on February 29, 2024, 05:30:03 PMAnd yet another question. What would be the syntax of a blank space?
You would add a blank space as you did, but you now need to put quotes around it. The command line uses spaces as a break between options, so to keep the space, add quotes
-d "%Y%m%d_%H%M%S%%-c -%%f%%e"Quoteedit: forgot to add -r to do all files in all subfolders, and -P so no changes are made in the tags
You can add them anywhere that they are not between the quotes of another option of the command, i.e., you can't stick it in the
"-testname<CreateDate" section, and as long as it's not between a two part option, i.e., you can't stick it between
-d and
"%Y%m%d_%H%M%S%%-c -%%f%%e". The easiest places are usually right after
exiftool or at the very end.
Thak you:)