Good day!
My rather small problem is as follows: there is a large folder (in the following example - it is called "2"), it contains several dozen subfolders ("A", "B", "C"); I would like to perform a massive file renaming - for example, 001.jpg , 002.png, 003.jpg...
I tried using this command as:
exiftool -r -fileOrder DateTimeOriginal "-filename=%1.03C.%e" D:\2 -overwrite_original -progress
used this one too:
exiftool -r -fileOrder DateTimeOriginal "-filename=%d/%01.3C.%e" D:\2 -overwrite_original -progress
and they work great.
But when renaming, the numerical sequence of names from one folder continues to another (035.jpg, 036.png - and 0.37 - in another folder).
What can be done to rename all files nested in subfolders with a single command, but the sequence starts anew in each of them (035.jpg, 036.png - in one folder, and 001.jpg - in another folder, etc.).
Thanks!
P.s.: I tried the method from the reverse indicated here (https://exiftool.org/forum/index.php?topic=5628.0) - it didn't help.
My OS: Windows 11 Pro 22H2
Exiftool version: 12.58
Type of file: *jpg, *png
From the application -w option documentation:
For %C, a copy number of zero is not
omitted as it is with %c. A leading '-' causes the number to be
reset at the start of each new directory, and '+' has no effect.
(emphasis added)
- Phil
Thanks a lot for the tip. But what will the team look like then, if not a secret?
Just add a "-" after the "%" for the "C" format specification. eg. "%-1.03C"
- Phil
Unfortunately, I put a minus - but the numbering also continued...
exiftool -r -fileOrder DateTimeOriginal "-filename=%-1.03C.%e" D:\2 -overwrite_original -progress
Right. I didn't notice you were using the -fileorder option:
-fileOrder
Note that files are sorted across directory boundaries
if multiple input directories are specified.
That is a problem. I don't see an easy work-around other that possibly renaming according to DateTimeOriginal first, then hoping the system returns files in FileName order.
Also, you don't need the -overwrite_original option if just writing FileName.
- Phil
I solved the problem using this:
exiftool -r "-filename=%2.03nc.%e" D:\2 -progress
After all, the simplest solution is sometimes the best move.
Thanks Phil, for your help and sorry to bother you.
No bother at all. In fact, this question pointed out a problem in ExifTool that I will fix in the next version.
With version 12.59 and later you will be able to do what you want, and %-C will work with the -fileOrder option. (Note that %-C was also broken by the -progress option, but this will be fixed as well.)
- Phil
I'm glad it was helpful to some extent)