Very cryptic subject title, but alas :)
In have a directory A with the last (newest) 3 files named like:
2021.03.27_173912_X01316.ORF
2021.03.27_173943_X01317.ORF
2021.03.27_174003_X01318.ORF
My incoming files are in directory B and I have a nice set of exiftool commands to process those, but the last one is a pain in the head:
exiftool -filename=%-.4f%.5nC.%e -fileorder FileName <DIR-B>
This works, but is giving me files like:
2021.03.28_123456_X00001.ORF
2021.03.28_123459_X00002.ORF
etc.
I can specify the starting number for the sequence like this:
exiftool -filename=%-.4f%1319.5nC.%e -fileorder FileName <DIR-B>
but this is not flexible.
What I want is to determine the last sequence number from DIR-A (that is: 1318) and start with 1319.
The next time this is another number ofcourse.
How do I do this?
Exiftool only processes one file at a time. It doesn't have the ability to read the name of a file in a different directory to apply to the current file.
You would need a script to grab that value and then run the exiftool command with that value inserted.
That's the way I did it in the end :)
Grabbed the highest sequence number value, putted that into a variable and feeded it to exiftool. Easy peasy ;)
can't set the sequence starting number for my part:
./exiftool -ignoreMinorErrors -filename='FIXEDNAME-%4nc.%e' 'path'
thx for a help
There isn't an option to have a starting number when using a lower case c. You have to use the upper case C option. This also means that the count will increment for every file, not just duplicate names. See the Advanced features section of the -w (-TextOut) option (https://exiftool.org/exiftool_pod.html#w-EXT-or-FMT--textOut).
C:\>exiftool -testname=FIXEDNAME-%20.5nC.%e -fileorder filename Y:\!temp\ccc
'Y:/!temp/ccc/!56L!__!RaP!_.jpg' --> 'Y:/!temp/ccc/FIXEDNAME-00021.jpg'
'Y:/!temp/ccc/!RgB!_!HvZ!_.jpg' --> 'Y:/!temp/ccc/FIXEDNAME-00022.jpg'
'Y:/!temp/ccc/!YTT!_!GFz!_.Jpg' --> 'Y:/!temp/ccc/FIXEDNAME-00023.Jpg'
'Y:/!temp/ccc/!pKp!_!8uf!.jpg' --> 'Y:/!temp/ccc/FIXEDNAME-00024.jpg'
'Y:/!temp/ccc/!srk!_!SbH!_.jpg' --> 'Y:/!temp/ccc/FIXEDNAME-00025.jpg'
1 directories scanned
0 image files updated
5 image files unchanged
thx for the help, blindly reading ;)
got it:
./exiftool -ignoreMinorErrors -filename='FIXEDNAME-%750C.%e' 'path'
now I have got increment from 750. Great!
I tried to combine:
%C with %4nc to get:
- increment from defined number & 4 digits format
but it doesn't work:
./exiftool -ignoreMinorErrors -filename='FIXEDNAME-%750C%4nc.%e' 'path'
From the docs with regards to %C (%c is different)
The number before the decimal place gives the starting index, the number after the decimal place gives the field width.
exiftool -ignoreMinorErrors -filename='FIXEDNAME-%750.4nC.%e' 'path'
C:\>exiftool -testname=FIXEDNAME-%750.4nC.%e -fileorder filename Y:\!temp\ccc
'Y:/!temp/ccc/!56L!__!RaP!_.jpg' --> 'Y:/!temp/ccc/FIXEDNAME-0751.jpg'
'Y:/!temp/ccc/!RgB!_!HvZ!_.jpg' --> 'Y:/!temp/ccc/FIXEDNAME-0752.jpg'
'Y:/!temp/ccc/!YTT!_!GFz!_.Jpg' --> 'Y:/!temp/ccc/FIXEDNAME-0753.Jpg'
'Y:/!temp/ccc/!pKp!_!8uf!.jpg' --> 'Y:/!temp/ccc/FIXEDNAME-0754.jpg'
'Y:/!temp/ccc/!srk!_!SbH!_.jpg' --> 'Y:/!temp/ccc/FIXEDNAME-0755.jpg'
1 directories scanned
0 image files updated
5 image files unchanged
And without the n
C:\>exiftool -testname=FIXEDNAME-%750.4C.%e -fileorder filename Y:\!temp\ccc
'Y:/!temp/ccc/!56L!__!RaP!_.jpg' --> 'Y:/!temp/ccc/FIXEDNAME-0750.jpg'
'Y:/!temp/ccc/!RgB!_!HvZ!_.jpg' --> 'Y:/!temp/ccc/FIXEDNAME-0751.jpg'
'Y:/!temp/ccc/!YTT!_!GFz!_.Jpg' --> 'Y:/!temp/ccc/FIXEDNAME-0752.Jpg'
'Y:/!temp/ccc/!pKp!_!8uf!.jpg' --> 'Y:/!temp/ccc/FIXEDNAME-0753.jpg'
'Y:/!temp/ccc/!srk!_!SbH!_.jpg' --> 'Y:/!temp/ccc/FIXEDNAME-0754.jpg'
1 directories scanned
0 image files updated
5 image files unchanged