Numbering folders with different names?

Hello:

I often have this kind of folder structure:

01 – Introduction

02 – Proposals

03 – Final result

etc.

Is it possible to number folders like that with some script, and in such a way that if I remove, for instance, folder "02", folder "03" and subsequent changes to "02" and so on?

Regards,

Hans L

There is a renumbering rename script somewhere in the Rename forum that I think will do this.

MrC, I guess you did not mean "forum", but "section" or something like that. It is on page 629 in the manual.

It says it pertains to files, but maybe folders too. I will try it.

Thank you.

Hans L

No, I meant the Rename Scripting forum here.

The script I was thinking of is under the thread "Add a Unique Number while renaming".

But it may not do what you want if there is a particular order of the file names you need to retain (i.e. Introduction always before Proposals, which is always before Final result).

Looks like something you can solve with the sequential numbering option in the rename dialog, probably without any scripting.

If you link your account we'll give an exact example.

[quote="MrC"]No, I meant the Rename Scripting forum here.

The script I was thinking of is under the thread "Add a Unique Number while renaming".

But it may not do what you want if there is a particular order of the file names you need to retain (i.e. Introduction always before Proposals, which is always before Final result).[/quote]

Okay, I see.

Well, I was thinking of creating the folders in the order I want, and then number them.

I'll check out the post you referred to.

Thanks,

Hans L

[quote="leo"]Looks like something you can solve with the sequential numbering option in the rename dialog, probably without any scripting.

If you link your account we'll give an exact example.[/quote]

I will try that too, Leo. Now, what do you mean by "If you link your account we'll give an exact example."?

Hans L

See my signature or the top of the page.

Leo, I am linked.

Thanks,

Hans L

If you don't mind having two buttons, one for initialize the number scheme and an other for "renumbering" in case of changes, these two commands should work:

Button 1 - Initialize: Rename PATTERN "(.)" TO "[#] - \1" REGEXP NUMBER=01 TYPE=dirs
Button 2 - Renumber: Rename PATTERN "([0-9][0-9]) - (.
)" TO "[#] - \2" REGEXP NUMBER=01 TYPE=dirs

That would be fine. Could there be one button, with 1 = leftclick and 2 = rightclick?

Hans L

Try this in a button:

Rename PATTERN "^(\d+ - )?(.+)$" TO "[#] - \2" REGEXP NUMBER=01 TYPE=dirs

[quote="MrC"]Try this in a button:

Rename PATTERN "^(\d+ - )?(.+)$" TO "[#] - \2" REGEXP NUMBER=01 TYPE=dirs[/quote]
I'll try that one too.

Thanks/Hans L

May I suggest that on page 420 in the manual, this ...

"Add a new, empty button

To add a brand new button (one with no function defined) to a toolbar, do any of the following:

o Drag the New Button command from the Commands tab of the Customize dialog, and drop it on the toolbar. This will add the button at the location you dropped it."

... be changed to

"... o In Customize dialog box – Commands tab – Commands: – New, drag Drag the New Button command to your toolbar of choice."

Note that not only the format is different, but, more importantly, "New" has been added.

Best regards,

Hans L

[quote="Miran"]If you don't mind having two buttons, one for initialize the number scheme and an other for "renumbering" in case of changes, these two commands should work:

Button 1 - Initialize: Rename PATTERN "(.)" TO "[#] - \1" REGEXP NUMBER=01 TYPE=dirs
Button 2 - Renumber: Rename PATTERN "([0-9][0-9]) - (.
)" TO "[#] - \2" REGEXP NUMBER=01 TYPE=dirs[/quote]

Initialize works.

If I have

01 – xxx
02 – yyy
04 – zzz

and I highlight and click :Renumber", nothing happens.

Regards,

Hans L

[quote="MrC"]Try this in a button:

Rename PATTERN "^(\d+ - )?(.+)$" TO "[#] - \2" REGEXP NUMBER=01 TYPE=dirs[/quote]

This works initially.

If I have

01 – xxx
02 – yyy
04 – zzz

and I highlight and click again, this is the result:

01 - Folkshul
02 - PSJO
03 - 04 – New Folder

Regards,

Hans L

I don't see that result, and I certainly don't see file name "xxx" turn into "Folkshul", etc.

It might be that your filenames are not using dash characters, but a similar looking character (an En Dash). So, here's a modified version to support both:

Rename PATTERN "^(\d+ [-\u2013] )?(.+)$" TO "[#] - \2" REGEXP NUMBER=01 TYPE=dirs

Sorry, should have been

This works initially.

If I have

01 – Folkshul
02 – PSJO
04 – New Folder

and I highlight and click again, this is the result:

01 - Folkshul
02 - PSJO
03 - 04 – New Folder

And, you are right, I use en dashes.

Thanks,

Hans L

[quote="MrC"]I don't see that result, and I certainly don't see file name "xxx" turn into "Folkshul", etc.

It might be that your filenames are not using dash characters, but a similar looking character (an En Dash). So, here's a modified version to support both:

Rename PATTERN "^(\d+ [-\u2013] )?(.+)$" TO "[#] - \2" REGEXP NUMBER=01 TYPE=dirs[/quote]
Works beautifully!

Now, if I want to do the initial numbering and any renumbering with En dashes, what do I change (the two "-" to "–"?)?

Hans L

Sorry, are you asking how to replace the dash with En Dash? If so, use:

Rename PATTERN "^(\d+ [-\u2013] )?(.+)$" TO "[#] – \2" REGEXP NUMBER=01 TYPE=dirs

Note that the red dash is actually an En Dash.