ExifTool Forum

ExifTool => Bug Reports / Feature Requests => Topic started by: StarGeek on December 15, 2021, 12:58:08 PM

Title: Filename that includes -w % replacement
Post by: StarGeek on December 15, 2021, 12:58:08 PM
I have a file that includes a %##D sequence and that sequence is being treated as one of the -w (-TextOut) option (https://exiftool.org/exiftool_pod.html#w-EXT-or-FMT--textOut) replacements even though I'm passing a directory and not an individual filename.

As an example, a file named File %28D_7103.jpg, where the %28 was an URL encoded parenthesis ( from when it was downloaded.
C:\>exiftool -v3 "-Filename<${BaseName;s/\d+$//}.%e" Y:\!temp\bbb\PercentProblem
======== Y:/!temp/bbb/PercentProblem/File %28D_7103.jpg
Setting new values from Y:/!temp/bbb/PercentProblem/File %28D_7103.jpg
Writing File:FileName
'Y:/!temp/bbb/PercentProblem/File %28D_7103.jpg' --> 'File Y:/!temp/bbb/PercentProblem_.jpg'
Error creating directory File Y:
Warning = New file name not allowed in Windows (contains ':')
Warning: New file name not allowed in Windows (contains ':') - Y:/!temp/bbb/PercentProblem/File %28D_7103.jpg
    1 directories scanned
    0 image files updated
    1 files weren't updated due to errors


So even though I'm not passing the actual filename on the command line, the %28D is treated as a formatted %D.

This is probably pretty obscure and I can't think of an easy way to deal with this off hand.
Title: Re: Filename that includes -w % replacement
Post by: Phil Harvey on December 15, 2021, 01:49:53 PM
Interesting.  You can add s/%/%%/g to your expression to fix this.  I guess this is the thing to do any time a tag copied to the filename may contain a "%"

- Phil