Filename that includes -w % replacement

Started by StarGeek, December 15, 2021, 12:58:08 PM

Previous topic - Next topic

StarGeek

I have a file that includes a %##D sequence and that sequence is being treated as one of the -w (-TextOut) option 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.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Phil Harvey

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
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).