News:

2023-03-15 Major improvements to the new Geolocation feature

Main Menu

Renaming photos with a copy number

Started by millerstevew, August 09, 2013, 06:55:03 PM

Previous topic - Next topic

millerstevew

I would like to rename my photos with a copy number that begins at one and omits the copy number when there are no duplicates. I can successfully introduce a copy number that starts at one with the following command, which I discovered here https://exiftool.org/forum/index.php?topic=4660.0:

exiftool '-FileName<datetimeoriginal' -d "%Y-%m-%d %H.%M.%S%%-.2nc.%%le" FILE

I know that exiftool omits copy numbers when beginning at zero, which I found here http://www.exiftool.org/exiftool_pod.html under copy number. Is it possible to omit the copy number when beginning with one?

Thanks for the help,
Steve Miller

Phil Harvey

Hi Steve,

I'm not clear exactly what you want.  Is it like this?:

XXX.jpg
XXX-02.jpg
XXX-03.jpg

?

If so, just drop the "." to give %%-2nc

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

millerstevew

I want the files to look like this:

aaa.jpg
bbb.jpg
ccc.jpg
ddd-01.jpg
ddd-02.jpg
ddd-03.jpg
eee.jpg

My file naming convention is "YYYY-MM-DD HH.MM.SS", and I want to use the copy number when there are date/time collisions.

- Steve

Phil Harvey

Hi Steve,

Ah.  Bummer.  Not possible.  Unfortunately, ExifTool can not look into the future to see if there will be more files named "ddd.jpg", so it has no way to tell if the "-01" should be added when it names this file. (ExifTool does things in a single pass for efficiency.)

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