Inserting filename into the metadata using %f

Started by ericconn, November 23, 2020, 02:41:18 PM

Previous topic - Next topic

ericconn

I'm trying to insert the filename into the metadata for JPG's with an empty RawFilename field, using the %f wildcard. I'm using the below code, to no avail:

exiftool '-RawFilename=%f' -overwrite_original "C:\Test\Image1.jpg"

I tried it with and without the single quote around the underlined part.

Any suggestions? Thanks.

StarGeek

The percent tokens (%f, %e, %c, etc) can't be copied to a tag.  They're for use with various file operations and format strings, such as -TagsFromFile or -w (textout) options or setting the Filename/Directory pseudo tags.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

Phil Harvey

This should do what you want:

exiftool "-rawfilename<${filename;/(.*)\./ and $_=$1}" FILE

- 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 ($).