Rename pictures with pattern

Advanced Renamer forum
#1 : 21/07-24 16:25
Gioele Bossi
Posts: 1
Hi! I just found this software, and probably would help me with my big dataset of my master thesis :)

I have 100 folders with 39 pictures each. I would like to rename all the picuters with the same pattern and sequence, where the first digit would be the number of the folder.

I make the example with folder nr. 1:

*no change*
1__Himmel_A
1_Boden_A_N
1_Boden_A_O
1_Boden_A_S
1_Boden_A_W
*no change*
1__Himmel_B
1_20cm_B
1_130cm_B
1_Boden_B_N
1_Boden_B_O
1_Boden_B_S
1_Boden_B_W
*no change*
1__Himmel_C
1_20cm_C
1_130cm_C
1_Boden_C_N
1_Boden_C_O
1_Boden_C_S
1_Boden_C_W
*no change*
1__Himmel_D
1_20cm_D
1_130cm_D
1_Boden_D_N
1_Boden_D_O
1_Boden_D_S
1_Boden_D_W
*no change*
1__Himmel_E
1_20cm_E
1_130cm_E
1_Boden_E_N
1_Boden_E_O
1_Boden_E_S
1_Boden_E_W
*no change*

Will it be possible with Advanced Renamer? I don't need that it rename all folders at once, I can run the prompt for each folder manually and adapt the folder number in the script.

I'm not really in to programming, if it's not a big deal, would someone be so kind as to prepare a script for me?

Thanks a lot and greetings from Switzerland!
Gio
#2 : 22/07-24 01:02
Delta Foxtrot
Posts: 323
Reply to #1:

Howdy Gioele from deep in the heart of Texas! :)

I think there's a relatively simple way to do this, but I need to know how your directories are named. The reason being that a simple list method will change the filenames to what you want, I've already got that working, but the incrementing first character would have to then be derived from the directory name. So if, for instance, your folders were named "sometext_1", "sometext_2", etc., that would be ideal. I just need to find a way to adjust whatever you have now. So if you would, please respond with:

1. The current directory name pattern (I'm hoping for a pattern anyway) :)
2. It would be useful to know how the files are currently named, just so I can create dummy copies using your filenames and test the final outcome. EDIT: Also to make sure the filenames that aren't being changed don't react with the changes being made by the program. END EDIT

I'm pretty sure that as soon as I have that information I can give you a workable way to rename all your files, and it shouldn't involve having to tweak a batch method for 100 different directories. :)

Best regards,
DF

edited: 22/07-24 01:49
#3 : 22/07-24 04:53
Delta Foxtrot
Posts: 323
Reply to #2:


Gioele,

I decided to document what I've done using the limited information I have so far. Mainly because I'm tired of working and wanted something else to do while waiting for your reply. :)

I took the names you wanted for each traunch of 39 files and copied it to a text editor. Then I replaced each instance of "*no change*" with the ARen tag <Name>, which just gives us the original filename back in place. The "1" at the start of each filename I replaced with the tag <Foldername>, which will act to replace the original first character with the name of the folder. We'll later take that foldername and pare it down to a number identifying the folder as you specified.

Ok, that's the basis for the list we will create to place into an ARen LIST method. In my tests I used filenames like "temp025", "temp026", etc, but it really shouldn't matter what the filename is (as long as it doesn't conflict with foldernames, which I can't ascertain until you answer my questions from the post above). For my directory names I used "test1", "test2", "test3" and "test99".

To finish creating the list I just copied the first 39 entries and pasted, and pasted and pasted, then copied the new list and pasted that, until I had more than the 3900 entries we'll need for you 100 folders of 39 files each (3900 files is really nothing for ARen to process at onces, so after a test that's how I'd do it).

I then copied that list of 3900+ lines and pasted into a LIST method. I loaded my 3 directories of files up (drag and drop the folders into ARen, then specify FILES in the popup window). ARen worked its magic and in the "New filename" preview column I got files that looked like this:

temp025.jpg
test1__Himmel_A.jpg
test1_Boden_A_N.jpg
test1_Boden_A_O.jpg
[etc etc]

...followed by test2 names, then test99 names.

Basically the job is done, except for removing the extraneous part(s) of the directory name. And of course if the directory name isn't in a good format we'll have to FIRST take care of that. But really, the above is the heavy lifting for the total rename, with just a little (maybe) preparation and some cleanup after. The only possibly tricky part I see is making sure that we don't change the names of the files that need to stay with their original names while we clean up the other filenames.

(Just as an example, with my "testn..." folder names prepended to the filenames, I used a replace method like this (using regular expressions):
Text to replace: ^test(\d{1,3})_
Replace with: $1_

...and that's it! The filenames you need.

Ok, whenever we get the other information I'm ready. :) I placed a copy of the list text file I used at https://drive.google.com/file/d/1x8_n8iTSkSOHAiE h_A_2PaW-tK1Z0j9-/view?usp=sharing
but I'd suggest you make your own just so if it's screwed up you can blame yourself instead of me! :) But you can at least see what I did.

Best,
DF


edited: 22/07-24 04:55