Invalid Tag Name when using filename format codes (but not tags)
yutotakano opened this issue · comments
Environment
Windows 10, with exiftool 12.36. Running commands directly in the terminal.
Issue
When the -filename
or -testname
feature is used to rename files, Exiftool errors as "Invalid Tag Name" when there is no presence of a dollar sign.
That is, the following does not work (expected behaviour is to rename to the same name)
> exiftool "-testname<%f.%e" IMG_20201021_084255.jpg
Warning: No writable tags set from IMG_20201021_084255.jpg
Warning: Invalid tag name '%f.%e' - IMG_20201021_084255.jpg
0 image files updated
1 image files unchanged
Adding a single dollar sign anywhere makes the above work (although now we have a dollar sign in the output filename).
> exiftool "-testname<%f.%e$" IMG_20201021_084255.jpg
'IMG_20201021_084255.jpg' --> 'IMG_20201021_084255.jpg$'
0 image files updated
1 image files unchanged
This leads me to suspect that the testname
and filename
arguments do not work when there are no other tags references using a dollar sign. However, the above is a valid use case (albeit meaningless), so I believe this to be a bug.
Specific use case
The above may be meaningless and can be done with -testname<$filename
. However, my specific use case is to move the file to a different directory using -directory
, and also use -filename<%f%c.%e
, so that duplicates files are properly handled. To insert the copy number between the filename and extension, $filename
is not enough.
The "<" operator is for copying tags, but you have no tags in your expression. Use "=" instead.
- Phil
I'll improve the warning message to say this:
Warning: Invalid tag name '%f.%e'. Use '=' instead of '<' to assign a tag value
Ah! Now that I search for it, it's definitely there in the manual (and at the top as well). Pardon me, I had dived into exiftool
with only example usages and hadn't read through the manual properly.
Thank you for improving the warning message as well. I'll keep the issue open in case you need it for tracking the warning message improvement, but please feel free to close it if you desire.