ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Birdman on October 27, 2023, 04:02:23 PM

Title: Copy Exif tags for several files in a directory
Post by: Birdman on October 27, 2023, 04:02:23 PM
Hi everyone,

I am looking for a solution to process the following command to several files in a directory:
exiftool -TagsFromFile File.jpg File-NoExif.jpg
The files are something like this:
File1.jpg File1-NoExif.jpg
File2.jpg File2-NoExif.jpg
File3.jpg
File4.jpg File4-NoExif.jpg

If there is a file containing "-NoExif" in the filename, the command should be executed and copy all exif tags from the "normal" jpg to the "-NoExif" jpg.

Is it possible to manage this with Exiftool alone?
Title: Re: Copy Exif tags for several files in a directory
Post by: StarGeek on October 27, 2023, 04:59:57 PM
Try
exiftool -if "$Filename=~/NoExif/" -TagsFromFile %d%-.7f.%e -EXIF:All /path/to/files/

First, it checks to see if "NoExif" is in the filename.  Then, it will look for a file to copy from in the same directory and snip seven characters from the end of the base filename.

Change the double quotes to single quote if using Mac/Linux.
Title: Re: Copy Exif tags for several files in a directory
Post by: Birdman on October 27, 2023, 05:37:57 PM
Thanks. Do I have to change something when working with Windows?
exiftool -if "$Filename=~/genErase/" -TagsFromFile %d%-.9f.%e -EXIF:All D:\Bilder\Neu\Exiftool\Test\The following message is shown when executed:

D:\Bilder\NEU\exiftool\Test>exiftool -if "$Filename=~/genErase/" -TagsFromFile -.9f.All D:\Bilder\Neu\Exiftool\Test\
File '-.9f.All' does not exist for -tagsFromFile option

Solved: Needs %% instead of % Works now perfectly, thanks again!
Title: Re: Copy Exif tags for several files in a directory
Post by: StarGeek on October 27, 2023, 08:29:51 PM
FAQ #27 (https://exiftool.org/faq.html#Q27)