ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Beholder3 on April 08, 2015, 01:38:25 PM

Title: file renaming: option to auto number on duplicates?
Post by: Beholder3 on April 08, 2015, 01:38:25 PM
Hi,

currently I use the tag -filename<"$focallength mit AF Feinverstellung $makernotes:AFAdjustment.%e" to rename picture to state their focal length and autofocus fine adjustement used.
But that doesnt work if many files have the same values and so they are not being renamed at all.

Is there a way to automatically append an increasing number to the filename if the same filename already exists?
For example if there already is a "file_A" and I do rename "fileDDDDD" to "file_A" it should create "file_A 1" or "file_A 0001" or something similar.

Title: Re: file renaming: option to auto number on duplicates?
Post by: Phil Harvey on April 08, 2015, 01:45:20 PM
The "%c" format code is exactly what you need.  Try this:

-filename<"$focallength mit AF Feinverstellung $makernotes:AFAdjustment%-c.%e"

Here I have used "%-c" to add a "-" before the number.

- Phil
Title: Re: file renaming: option to auto number on duplicates?
Post by: Beholder3 on April 10, 2015, 01:05:56 PM
Thanks a lot again.  :)

Can you also tell me what search / click logic I would have needed to follow to find this in the tool documentation on this site?
Title: Re: file renaming: option to auto number on duplicates?
Post by: Phil Harvey on April 10, 2015, 01:22:17 PM
This is documented in the 5th paragraph of the writing FileName page (https://exiftool.org/filename.html), which is linked from here (https://exiftool.org/index.html#filename) on the home page, and from the FileName description in the Extra tags documentation (https://exiftool.org/TagNames/Extra.html).  It is also described in the RENAMING EXAMPLES section of the application documentation (https://exiftool.org/exiftool_pod.html#renaming_examples).

My question is:  Where did you look for it?  Perhaps it should also be mentioned elsewhere.

- Phil

Title: Re: file renaming: option to auto number on duplicates?
Post by: Beholder3 on April 12, 2015, 08:48:30 AM
Ah, thanks. I screwed my search then.

I opened the application page https://exiftool.org/index.html#filename and did a local on page search for the word "filename".
Somehow I read the last sentence "Read here (http://owl.phy.queensu.ca/%7Ephil/exiftool/filename.html) for more details about this powerful feature." as to reference only the directory changing example directly above and did not click on it. Poor reading on my side.

The linked https://exiftool.org/filename.html does open up a whole new world.  :)

For stupids like me maybe you put a hyperlink on the title "renaming" directly.  ;)