Add sequence number to files - not working

Started by nmichelle, April 28, 2023, 01:03:33 PM

Previous topic - Next topic

nmichelle

Hello,
I am a total beginner in ExifTool. I have many folders containing .MP4 files and I am trying to rename them folder by folder.
Until now I have added a comment to the metadata of all the files in one folder and next I run

exiftool -r "-filename<${Comment}__${CreateDate}%-c.%e" -d "%Y-%m-%d__%H-%M-%S" .

I get an output file name which is comment__date__hour . I also want a sequence number e.g. __001, 002, etc. added as a suffix to each file name (following the chronological order of the creation date and time).

I found another thread https://exiftool.org/forum/index.php?topic=10975.0 but once I run the command

exiftool -r "-filename<${Comment}__${CreateDate}__%.nc.%e" -d "%Y-%m-%d__%H-%M-%S" . -ext mp4

I get all the files with the same suffix '__1' , instead of sequential numbers.
What can I do to obtain the result I am looking for?

Thank you very much in advance

StarGeek

Using %c will only increment if there is a duplicate filename. I believe what you want to use is the capital C, e.g. %.nC

Example using testname
C:\>exiftool -G1 -a -s -Testname=%f_%.nc.%e Y:\!temp\aaaa
'Y:/!temp/aaaa/Test_a.jpg' --> 'Y:/!temp/aaaa/Test_a_1.jpg'
'Y:/!temp/aaaa/Test_c.jpg' --> 'Y:/!temp/aaaa/Test_c_1.jpg'
'Y:/!temp/aaaa/Test_b.jpg' --> 'Y:/!temp/aaaa/Test_b_1.jpg'
    1 directories scanned
    0 image files updated
    3 image files unchanged

C:\>exiftool -G1 -a -s -Testname=%f_%.nC.%e Y:\!temp\aaaa
'Y:/!temp/aaaa/Test_a.jpg' --> 'Y:/!temp/aaaa/Test_a_1.jpg'
'Y:/!temp/aaaa/Test_c.jpg' --> 'Y:/!temp/aaaa/Test_c_2.jpg'
'Y:/!temp/aaaa/Test_b.jpg' --> 'Y:/!temp/aaaa/Test_b_3.jpg'
    1 directories scanned
    0 image files updated
    3 image files unchanged
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

nmichelle

Thank you!

I solved using %1.4C.%e because I wanted four digits and I added -fileorder FileName to get them in chronological order.

If a video file is corrupted I cannot add tags to it and the name will remain as the original(MMDD0001,2,etc.). Unfortunately then it will be placed at the top and when I rename the files it will be assigned the number 0001. In that way I lose the consistency from the numeration that the camera gave to the videos.
Is there any way to bypass this problem? 

nmichelle

Quote from: nmichelle on May 05, 2023, 06:32:35 AMThank you!

I solved using %1.4C.%e because I wanted four digits and I added -fileorder FileName to get them in chronological order.

If a video file is corrupted I cannot add tags to it and the name will remain as the original(MMDD0001,2,etc.). Unfortunately then it will be placed at the top and when I rename the files it will be assigned the number 0001. In that way I lose the consistency from the numeration that the camera gave to the videos.
Is there any way to bypass this problem? 

Actually the numbering by chronological order seems not to be working well when in the same folder there are video files from 2022 and 2023...I don't understand why. Can you suggest another way of doing it? Thanks!

StarGeek

Quote from: nmichelle on May 05, 2023, 06:32:35 AMUnfortunately then it will be placed at the top and when I rename the files it will be assigned the number 0001. In that way I lose the consistency from the numeration that the camera gave to the videos.

Placed at the top of what?  I don't know how you are viewing the files data.

Just a guess, but if you're looking at the file system time stamps, you probably want to add the -P (-preserve) option.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).