Help wih renaming files

Started by MnM, May 23, 2024, 01:49:18 AM

Previous topic - Next topic

MnM

Hi,

Not too long ago I asked for help to be able to rename and move my photos from a temporary folder to a new (and final) folder, while also creating year/date folders in the process.

https://exiftool.org/forum/index.php?topic=16000.msg86077

Basically this the process I was needed assistance with:

Every night I have my mobile phones move the pictures into a folder on my NAS. That folder (for this exercise) is Z:/Incoming/PhotosTest.

What I want to achieve is:

1. Rename the photo files as this example:
23-10-2022-21-29-46-001
23-10-2022-21-29-49-002
24-04-2024-15-09-04-001
24-04-2024-15-09-22-002
where the numbers at the end (001, 002) always starts from 001 for each month.

2. Next I want to create folders like Year and Month (month to be like 01-Jan-2024 for example) in the final path where the photos will "live" and from where they will be backed up to external USB and cloud.

The final folder structure will look like this:

2024
04-Apr-2024
24-04-2024-15-09-04-001
24-04-2024-15-09-22-002
10-Oct-2024
24-10-2024-15-09-04-001
24-10-2024-15-09-22-002

2023
01-Jan-2023
24-01-2024-15-09-04-001
24-01-2024-15-09-22-002
10-Dec-2024
24-12-2024-15-09-04-001
24-12-2024-15-09-22-002

3. Photos might be moved at a later date into already existing year folders and month sub-folders in the final destination directories.

The solution provided is working fine - I have tested it and it works really well for points 1 and 2 above.
What is not really working as it should point 3 above. Basically photos added daily will always have the suffix starting from 001.

I wonder if there is a way to continue the numbering instead of starting from 001 again?
This way I can have all the monthly photos with correct numbering.

Thank you again for your help with this.

StarGeek

No, I do not believe there is a way to automatically start the count based upon the counter of a previously existing file.  You would need a script to figure out what the highest number in the folder was and then pass that to exiftool, and this would need to be done separately for each folder.

The easiest thing to do would be to copy the new files normally and then run a second pass to rename to correct the count.
* 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).

MnM

Thank you - I guess is not too bad and I can run a second pass to get the numbering correct.

MnM

I have tried to make this work but I am encountering issues.

Below are the commands that I using to rename and move files:

Prepare files for correct suffix 001, 002 etc
exiftool "-FileName<Datetimeoriginal" -d "%Y-%m-%%.3nc.%%e" -fileorder datetimeoriginal -ext jpg -r Z:/Uploads/PhotosAndVideos/Photos

Rename and move to correct folders
exiftool "-FileName<Datetimeoriginal" -d "Z:/Photos/%Y/%m-%b-%Y/%d-%m-%Y-%H-%M-%S-%%-3f.%%e" -ext jpg Z:/Uploads/PhotosAndVideos/Photos
Next I am trying to run a second pass on the folders created above (so i can rename the suffixes correctly) but I have no idea how to make it scan only the folders (year/months) that were created above.
I need help with this part please.

MnM


StarGeek

I can't think of a way to only process the newly created folders from just exiftool.
* 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).