Help needed with renaming files

Started by MnM, April 28, 2024, 10:56:45 PM

Previous topic - Next topic

StarGeek

I had a misunderstanding of the - in the %C.  It restarts the numbering in the original directory structure, not the new directory structure.

Run the command once to get them all in the correct directories, and then run it again to get the correct numbers.

Example:
C:\>exiftool -G1 -a -s -ext jpg -r -p "$filepath" Y:\!temp\x\y
Y:/!temp/x/y/001.JPG
Y:/!temp/x/y/002.JPG
Y:/!temp/x/y/003.JPG
Y:/!temp/x/y/004.JPG
Y:/!temp/x/y/005.JPG
Y:/!temp/x/y/006.JPG
Y:/!temp/x/y/007.JPG
Y:/!temp/x/y/008.JPG
Y:/!temp/x/y/sub1/009.JPG
Y:/!temp/x/y/sub1/010.JPG
Y:/!temp/x/y/sub1/011.JPG
Y:/!temp/x/y/sub1/012.JPG
    2 directories scanned
   12 image files read

C:\>exiftool -d "Y:/!temp/x/y/%Y/%m-%b-%Y/%d-%m-%Y-%H-%M-%S-%%-1.3C.%%e" "-Filename<dto" Y:\!temp\x\y -r
    2 directories scanned
    2 directories created
   12 image files updated

C:\>exiftool -G1 -a -s -ext jpg -r -p "$filepath" Y:\!temp\x\y
Y:/!temp/x/y/2022/10-Oct-2022/22-10-2022-19-30-58-001.JPG
Y:/!temp/x/y/2022/10-Oct-2022/23-10-2022-21-29-46-002.JPG
Y:/!temp/x/y/2022/10-Oct-2022/23-10-2022-21-29-46-003.JPG
Y:/!temp/x/y/2022/10-Oct-2022/23-10-2022-21-29-46-004.JPG
Y:/!temp/x/y/2022/10-Oct-2022/23-10-2022-21-29-49-003.JPG
Y:/!temp/x/y/2022/10-Oct-2022/27-10-2022-11-20-03-008.JPG
Y:/!temp/x/y/2022/10-Oct-2022/27-10-2022-11-20-05-001.JPG
Y:/!temp/x/y/2024/04-Apr-2024/24-04-2024-15-09-04-004.JPG
Y:/!temp/x/y/2024/04-Apr-2024/24-04-2024-15-09-22-005.JPG
Y:/!temp/x/y/2024/04-Apr-2024/24-04-2024-15-10-04-002.JPG
Y:/!temp/x/y/2024/04-Apr-2024/25-04-2024-11-57-08-006.JPG
Y:/!temp/x/y/2024/04-Apr-2024/25-04-2024-13-28-04-007.JPG
    6 directories scanned
   12 image files read

C:\>exiftool -d "Y:/!temp/x/y/%Y/%m-%b-%Y/%d-%m-%Y-%H-%M-%S-%%-1.3C.%%e" "-Filename<dto" Y:\!temp\x\y -r
    6 directories scanned
    8 image files updated
    4 image files unchanged

C:\>exiftool -G1 -a -s -ext jpg -r -p "$filepath" Y:\!temp\x\y
Y:/!temp/x/y/2022/10-Oct-2022/22-10-2022-19-30-58-001.JPG
Y:/!temp/x/y/2022/10-Oct-2022/23-10-2022-21-29-46-002.JPG
Y:/!temp/x/y/2022/10-Oct-2022/23-10-2022-21-29-46-003.JPG
Y:/!temp/x/y/2022/10-Oct-2022/23-10-2022-21-29-46-004.JPG
Y:/!temp/x/y/2022/10-Oct-2022/23-10-2022-21-29-49-005.JPG
Y:/!temp/x/y/2022/10-Oct-2022/27-10-2022-11-20-03-006.JPG
Y:/!temp/x/y/2022/10-Oct-2022/27-10-2022-11-20-05-007.JPG
Y:/!temp/x/y/2024/04-Apr-2024/24-04-2024-15-09-04-001.JPG
Y:/!temp/x/y/2024/04-Apr-2024/24-04-2024-15-09-22-002.JPG
Y:/!temp/x/y/2024/04-Apr-2024/24-04-2024-15-10-04-003.JPG
Y:/!temp/x/y/2024/04-Apr-2024/25-04-2024-11-57-08-004.JPG
Y:/!temp/x/y/2024/04-Apr-2024/25-04-2024-13-28-04-005.JPG
    6 directories scanned
   12 image files read

I didn't include the -fileorder datetimeoriginal that was in Phil's command, but it probably should be used.  If your camera fires in bursts, multiple shots/sec, then use SubSecDateTimeOriginal instead of DateTimeOriginal.
* 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).

Phil Harvey

Quote from: StarGeek on April 30, 2024, 07:19:40 PMI had a misunderstanding of the - in the %C.  It restarts the numbering in the original directory structure, not the new directory structure.

Right.  This could be confusing but I will try to make this more clear in the documentation.  It would be really tricky to implement the restarting of numbers in a new directory structure.

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