file renaming: option to auto number on duplicates?

Started by Beholder3, April 08, 2015, 01:38:25 PM

Previous topic - Next topic

Beholder3

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.


Phil Harvey

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

Beholder3

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?

Phil Harvey

This is documented in the 5th paragraph of the writing FileName page, which is linked from here on the home page, and from the FileName description in the Extra tags documentation.  It is also described in the RENAMING EXAMPLES section of the application documentation.

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

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

Beholder3

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 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.  ;)