Renaming with sub folders help


I created the Regular Expression in the screenshot below to rename files in a folder to be the name from it's 2 parent folders, while still keeping the original file name in the new name. The problem I'm having is the new name has [#] to give me new numbering and the numbering is continuing from folder to folder. Notice it's going 1 2 3, 4 5 6. I need it to do 1 2 3, 1 2 3. Any way to make this work?

The Regular Expression works fine if I do 1 folder at a time but that's not what I need. To many folders to do 1 at a time.

Any help would be appreciated!

You'll have to turn on Script mode and use some VBScript or JScript logic if you want a different count sequence to be used for different filename prefixes.

Normally I'd write the script but I'm super busy right now, sorry.

Hello Leo,

Maybe you have some time now to help me out with this? :smiley:


I think my Unique Numbers script already does what you want.

Thanks Leo!

That works almost 100% perfectly!

If I do the old name of * and try not to insert the old file name into the new file name, it works.

If I change the old file name to "(.+)...." and use "(\1)" in part of the new name, it messes up. Is something wrong with what I'm trying? I'd like it to work both ways... sometimes inserting the old name at the end of the new name.

Thank you for your time!

Messes up in what way?

What are you doing exactly? Maybe show a screenshot.

None of the files get renamed except for the first file and that only gets changed to "1)". All other files stay as their originals.

Here is a screenshot of the script. I changed [NUM] to use [#] just because I'm used to # for numbering :slight_smile:

You're using regular expressions but haven't set the Type drop-down to Regular Expressions.

If set it to Regular Expressions, I lose your script. Then If i import your script again, It goes back to Standard Rename. I'm I missing something?

Change the Type dropdown, not the preset list.

I am and your script and all settings disappear. :\

When I use the drop-down from Type, it changes the Preset as well.

Sorry, you're quite right.

That said, just tick Script Mode again after changing the Type drop-down.

Ahh, that worked as far as getting the script back.

Now on to the next problem... sorry.

Here is your script with a Regular Expression set so the original file name gets added to the end of the new name.

Here is the result. As you can see, the numbering stopped working but the original name is inserted.

Here is your script as is, which works.

Any thoughts on this one? Sorry to keep bugging you :slight_smile:

Damn, you're right, it's more complicated than I thought. :frowning:


How many cases of beer will it take to fix this complication? ;D


How many cases of beer will it take to fix this complication? ;D[/quote]

Let us know, how many you needed. I think, i too already experienced this small problem. It seems to be important to stick to the right order.

I meant it as more of a bribe to get him to work on it. Not that it's so hard to fix that it'll turn him to drinking. Is that what you meant abr? I'm a little lost. Didn't want to offend anyone.

I guess in my world it turned into a joke to offer game programmers alcohol to get things done or get into beta's :laughing:

Ok, i thought you needed some fuel to work through it :smiley: Drinking can give you, in some cases, some inspiration.
But one really has to watch the curve.

Beer is always accepted. :slight_smile:

Here you go: Number Within Sub-Folders rename script.

Leo you son of a gun!!! Works perfectly! :smiley:

Thank you so much for taking the time to write this for me (and others that might need it).

Now on to the important part... How to get you beer :wink: