Using exiftool to rename files associated to a specific filename

Started by Grouaaah, May 07, 2024, 10:55:25 AM

Previous topic - Next topic

Grouaaah

Hello,

I am trying to use the "fix the size of restored JPEG files" function on GraphicConverter 12 on a large number of files.

While some functions add "(original)" at the end of the files, it is simple to just make a research and delete every (original) file if needed after the manipulation.
 

For the "fix the size of restored JPEG files", it is a bit different. After using it, about ~2k files are duplicated with the "(fix)" mention at the end of the filename. The file to delete is not the "(original)" one, it is the file with the real filename (for example, 20240705_123456.jpeg).

I am trying to find a way to delete all the files corresponding to the ones containing "(fix)" at the end easily, so I can then rename every "(fix)" file since they are the ones I want to keep...

Would you know a solution to do it with exiftool or another reliable method?

Thank you very much

StarGeek

Exiftool doesn't delete files.

You could use it to move any matching files to another directory, though. Test it first, but it would be something like this
exiftool -if5 "$Filename~=/\(fix\)/i" -srcfile %d%-.5f.%e  "-Directory=/Move/Orig/Here/" /path/to/files/

This checks if the Filename contains "(fix)".  If it does, using the -srcfile option, it looks for a file with the same filename minus 5 characters from the end of the base filename (see the Advanced features section of the -w (-TextOut) option).  It will then move that file to the directory listed after "-Directory=.
"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

Martin B.

If you simply renamed each "filename (fix)" file to "filename", wouldn't this overwrite each "filename" without having to delete it first?

A simple Perl or shell script would do the job, or I'm sure there are "renamer" programs available for free on the web. This solution depends on the operating system you are using.

StarGeek

Quote from: Martin B. on May 07, 2024, 11:09:54 AMIf you simply renamed each "filename (fix)" file to "filename", wouldn't this overwrite each "filename" without having to delete it first?

It depends upon what is used. mv on the command line would overwrite it, depending upon the options used. And I think it can be used on Windows, Mac, and Linux.

And, as you say, there are a lot of renaming programs out there.

"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