Recurrent renumbering

Advanced Renamer forum
#1 : 27/02-24 21:41
KRFTSTFF
KRFTSTFF
Posts: 3
Hello,

I would like to renumber the following images as follows:

rochester_women-210.jpg
rochester_women-211.jpg
rochester_women-212.jpg
seattle_men-213.jpg
seattle_women-214.jpg
sierra_men-215.jpg
sierra_men-216.jpg
sierra_women-217.jpg
sierra_women-218.jpg

to

rochester_women-1.jpg
rochester_women-2.jpg
rochester_women-3.jpg
seattle_men-1.jpg
seattle_women-1.jpg
sierra_men-1.jpg
sierra_men-2.jpg
sierra_women-1.jpg
sierra_women-2.jpg

How can I accomplish this?

Thanks in advance for you advice and kind regards
Tally



27/02-24 21:41
#2 : 27/02-24 22:59
Delta Foxtrot
Delta Foxtrot
Posts: 118
Reply to #1:

Hi KR, (may I call you KR? <edit> Oh, wait, I'll call you Tally! <endedit> :)

WOW, that was an interesting exercise. Contextual renumbering is fun!

Ok, I'm not sure how familiar you are with Aren, so first I'm going to give you the bare-bones description of how it's done. If you need more help after that, just ask...

It's a two-step process in Aren, and then a little cleanup, but simple really. And it will work for any number of files as long as there is some defining similarity in front of the number - in this case the dash. I also used the underscore in my redefinition, but it's not necessary, just maybe a little harder to explain.

Obviously, you should do this with a COPY of your files just in case.

1. In MOVE mode, using no methods, set up a template in the "Output folder:" field such that each filename, without the number becomes a subdirectory name. So "rochester_women-nnn" becomes the subdir "rochester_women". You'll need <Substr> tags. Execute the batch and all your files will (should) end up in a directory that matches the name, minus the filenumbers.

2. Again using move, using an ouput folder parameter that points back to the original directory, add one replace method using regex that uses the <IncNrDir> tag to replace the original number in each filename. Load all the subdirs and do it.

If done correctly all your files will end up in their original location, together in the one directory, with spiffy new numbers as required.

<edit> You've then just to get rid of the excess clutter of subdirectories and Bob's your uncle. <endedit>

Good luck, and hit me back if you need clarification.

Best regards,
DF

<edit>
This worked for me on your sample set. Please practice safe data-handling! :)
<endedit>



27/02-24 22:59 - edited 27/02-24 23:11
#3 : 03/03-24 15:30
KRFTSTFF
KRFTSTFF
Posts: 3
Reply to #2:

Hey DF,

thanks for your help.

Unfortunately I couldn't get it running.

In the first move method, what should I write in the fields "move from" and "move count"? Should I leave them blank?
In the "move to" I added <Inc NrDir:1> but nothing happens when I started the batch.

It is hard for me to understand everything as I am not familiar with the advanced functions in Advancedrenamer and as I am not a coder. :-(

Best regards,
Tally


03/03-24 15:30
#4 : 03/03-24 17:42
Delta Foxtrot
Delta Foxtrot
Posts: 118
Reply to #3:

Hi Tally,

I'm sorry, I don't think I explained that very well, and I was in a hurry at the time.

Now I've typed up step by step instructions, but I've been up all night and I'm a little dingy and don't entirely trust myself. It turned out to be more novella than short story, so I'm going to sleep, double check my scribbles, then break it into two posts (instructions and explanation), THEN post it. That way you can get the job done and come back later if you want to learn what exactly you did. So I'll be back soon.

Best,
DF


03/03-24 17:42
#5 : 04/03-24 03:00
Delta Foxtrot
Delta Foxtrot
Posts: 118
Reply to #4:

Hi Tully,

OK, sleep-refreshed, here we go. First the how, but let me explain again quickly the process, maybe I can do better this time:

All your xxxx-xxxxx-n[n...] files that you want to rename are in one directory with no other files or folders. We are going to 1. move the files into subdirectories that Aren will create, each subdir taking its name from the base filename without the "-nnn" part. 2. While in those subdirs we rename the files using the IncNrDir tag to add incrementing numbers to the end of the filename, then move the files back into the original directory.

STEP 1:
Open Aren and clear the method list. Change the BATCH MODE switch from Rename to Move. That's above the file list menu at the top middle of the window. "Output folder:" will appear to its right, and enter/paste:

.\<Substr:1:_>_<Substr:_:->

Drag the appropriate folder into the File list section, check "Add the files in the folder:" then click OK in the pop-up window (no other fields checked or entered).

That's it, click "Start batch" and your files will be moved into the aforementioned subdirectories with their same names.

[NOTE: If you want to save these two steps (as separate batch jobs!) for future use, you'll have to add a blank method to step 1 (doesn't matter which method, just make it inactive). Aren won't save a batch definition without at least one method. This is the point to do that.]

STEP 2:
In the "Output files:" field we used above, change the entry from ".\<Substr:1:_>_<Substr:_:->" to the following:

..\

Next add a REPLACE method to the method list and set it up thusly:
------
Text to be replaced: (.*)-\d*

Replace with: $1-<IncNrDir:1>

Occurrence: All

Case sensitive: NO

Use regular expressions: YES

Apply to: NAME
------

Drag all those new subdirectories into the empty file list section and specify "Add the files in the folders" again. Check the List window preview and if good pull the trigger (OK, "Start batch") and your files should all be together back in your original directory. If you'd rather keep your files in separate subdirectories, in step 2 just change the Batch mode: field back to "Rename." The next time you do it, if you do, Aren will continue to use those subdirectories for the appropriate files and make new subdirs for any not already present.

There you go, good luck and double check you've got everything right the first time of course. If you want me to explain this in more detail just say so; I know I said I'd do that but I decided only if you want; I can be a little pedantic in case you haven't noticed. :) This is the short version! Yeah right...

Best,
DF



04/03-24 03:00
#6 : 04/03-24 13:31
KRFTSTFF
KRFTSTFF
Posts: 3
Reply to #5:

Hi DF,

thank you so so much for your new description.
It works.
I am so happy. That saves me so much work.

Can I buy you a coffee or do yo have an Amazon wishlist?
I don't know, if this is allowed here....

Best regards
Tally




04/03-24 13:31
#7 : 04/03-24 15:32
Delta Foxtrot
Delta Foxtrot
Posts: 118
Reply to #6:

Happy to help my friend. Someday you'll help someone else. :)

Have a great day!

Best,
DF


04/03-24 15:32