Rename Files Sequential Number Reset on new Folder

Hi. I would like to Rename a whole bunch of files in many subfolders, using the Sequential numbering option/approach.
However, I would like to have the numbering sequence -- reset or start over when the subfolder changes.
I am only interested in doing this for the *.MP3 files in theses subdirectories, which contain many audiobooks.
I might latter do this against my JPG folders.

There is a Rename dialog box that looks promising.
I have the following settings:
Old name: (.).(mp3) <--- I think this may select out just the mp3 files vs (.).(.*) which gets everything
New name: [#].\2
Type: Regular Expressions
Checked item: Rename files in selected sub-folders <--- cycles over all the sub-folders
Checked item: Sequential numbering from 0001 by 1

I need the Sequential numbering to reset back to 0001 when the subfolder changes.

Some Advice Please.

Edit: Use Leo's solution. Sorry I didn't find it.

--- Original Post ---
I'm not at my system currently, but found a post with a way to do it:

[ul][li]Renaming Photos via shooting time[/li][/ul]

I think the Number Within Sub-Folders rename script is exactly what you want.

Thank you both for your help. While I am making some progress, I am having some difficulties as well.

I selected one top level folder, which has several subfolders, which mainly (but not exclusively) contained MP3 files.
I brought up the Rename dialog box, and set the options as follows:

Old name: (.*)(.mp3) <---- I am only trying to rename the mp3 files
New name: (1)\2 <---- This should rename the files to be (1).mp3 but there will be name collisions
Using Type: Regular Expressions
With the following options selected:
Automatically rename if new filename exists
Rename files in selected sub-folders

It looks like when I pushed the “Ok” button, and the Rename ran -- only ONE file in each of the subfolders was renamed.
Ummmm – Is the “Rename files in selected sub-folders” option working properly?

If instead of one top level folder, I use select the files from using the Flat View – Mixed (no folders), and then call up the Advanced Rename dialog – the Rename proceeds much as I expected. The MP3 files are renamed. There may be some formatting issues and difficulties which I may look at after a while. The files have names similar to (2).mp3 (3).mp3 (4).mp3 .... --- Number is reset on changing folder.

I will soon try to write up what happens when I tried the “Number Within Sub-Folders”.

Be sure to enable Full Preview mode at the bottom of the preview, then it will look like:


Note that I also simplified the Old/New names and used Standard Rename here (just to give an additional example).

It sounds like warrenrh has only tried the first suggested method so far (which has been completely edited out of the thread now, making things rather confusing to anyone else) and has yet to try the Number Within Sub-Folders script, but is going to (from his last sentence above).

Here is what I happened when I tried using the “Number Within Sub-Folders” approach.
I went to a top level subfolder, and used the Flat View (Mixed No Folders). I used a filter to only retain the *.mp3 files. I selected these files, and brought up the Advanced Rename. I selected the “Numbre Within Sub-Folders” preset.
Everything looks good to me --
Old name: (.+).[^.]+ <--- I need to look up what this Regular Expression means, but I’m good to go.
New Name: {parent2} - {parent1} - [NUM] - (\1).{ext}
Type: Regular Expressions

Following Options are selected:
Enable file information fields
Rename files in selected sub-folders
Script mode

I run the Rename Script. Files are renamed, but not as I had hoped. Truth is I have many many audiobooks, with many folders, and files with different formats. The names are rather unpredictably formatted, but these are audiobook files, and the sort/naming sequence is really important to keep the playback in sequence. Here is an example of the rename process.

Original file path: D:\RHWDocuments\MyAudioBooks\work02\Abercrombie Joe\First Law Series\FL 3 - Last Argument of Kings

Original file name: JALA001-424 Joe Abercrombie - Last Argument Of Kings.mp3

New name: First Law Series - FL 3 - Last Argument of Kings - 001 - (JALA001-424 Joe Abercrombie - Last Argument Of Kings).mp3

Results are Not what I had hoped for.
I am using Directory Opus 10 -- latest version -- 10.5.1.2 (4874) x64

*** These may not be worth worry too much about. I did find a specialized Rename program, that could handle this type of problem of resetting the Counter, when changing SubFolders.

You're going to want to change the New name value to reflect your needs (that's why I gave a simplified Old name/New name, as I suspected the example would not be exactly what you wanted).

MrC. Yes. Thanks. It looks good to me. I may need to do some more work and testing to be sure, or see if I have some questions.
But Yes, your solution is working, and I believe I can go from here.

There might still be one outstanding issue -- dealing with the
Checked item: Rename files in selected sub-folders

It looks like when I pushed the “Ok” button, and the Rename ran -- only ONE file in each of the subfolders was renamed.
Ummmm – Is the “Rename files in selected sub-folders” option working properly?

It is working fine for me here - the screenshot shows that.

You must first select the "Rename files in selected sub-folders" and then go into Full Preview mode. This is required so that DOpus can enumerate all the files in the subfolders to present in the preview window.

Thanks -- I think you helped me get my problem solved. But --

The requirement to go into Full Preview mode, so that the option to "Rename files in selected sub-folders" would actually process all the files in the subfolder, appears to me to be a work around, or certainly an unusual/unexpected (to me) requirement.

If this has been discussed before my apologies.
There are references where people are saying use the Full Preview mode before running the Rename.
Nevertheless --
Getting one result if you use a Full Preview mode, and a different result if you do NOT use the Full Preview mode --
seems like a Bug to me.

I'm not finding any problems when not going into Full Preview mode. The recursion and numbering work correctly for me.