ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Marsu42 on April 21, 2017, 01:19:07 AM

Title: How to batch backup filenames into tags?
Post by: Marsu42 on April 21, 2017, 01:19:07 AM
I'd like to save the filenames of images into their metadata tags with one exiftool run, any hint how to do this?

This doesn't seem to work: exiftool -comment=%f *.jpg (or on Windows exiftool -comment=%%f *.jpg)

Thanks for any hints!
Title: Re: How to batch backup filenames into tags?
Post by: Phil Harvey on April 21, 2017, 07:13:16 AM
Try this:

exiftool "-comment<filename" DIR

- Phil
Title: Re: How to batch backup filenames into tags?
Post by: Stephen Marsh on April 21, 2017, 10:20:08 AM
As I also use Adobe products, such as Bridge which features a batch rename tool, I use the same tag as Adobe.


Add/Copy filename to Adobe Preserve Original Filename metadata entry (removing the file extension):

exiftool -r '-XMP-xmpMM:PreservedFileName<${filename;s/\.[^.]*$//}' 'DIR or FILE'



Add/Copy filename to Adobe Preserve Original Filename metadata entry (including file extension):

exiftool -r '-XMP-xmpMM:PreservedFileName<${filename}' 'DIR or FILE'


Rename files using their preserved filename metadata entry:

exiftool -r '-FileName<XMP-xmpMM:PreservedFileName' 'FILE or DIR'