News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

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.
* 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

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