Command: CreateFolderEx (extended CreateFolder command)

CreateFolderEx - a script command for extended "CreateFolder" functionality.

Commandline params:


NUMBERED - Create multiple numbered folders.

Consider usage in combination with "{dlgString}" to request only specific params.

Options:

  • start (start index, optional)
  • end (end index, required + standalone)
  • interval (numbering interval, optional)
  • pad (number of digits, defaults to "2", disable with "0")
  • add (remember last used index and add x folders, optional)
  • set (set last used index, optional + standalone)
  • reset (reset/clear last index, optional + standalone)
  • resetall (reset/clear all indexes, optional + standalone)
  • addexisting (determine last index in current folder and add x folders, optional)

Examples:

Create 20 folders, numbered from 1-20, called "My NumFolders XX":

CreateFolderEx NAME="My NumFolders" NUMBERED="end=20"

Numbering put to the front and separated by "-", ask for start index:

CreateFolderEx NAME="My NumFolders" NUMBERED="end=20,start={dlgstring|Enter start:|5}" PATTERN="%num%-%name%"

Skip all the uneven ones, disable the zero-padding and put them to "C:\tmp":

CreateFolderEx NAME="C:\tmp\My NumFolders" NUMBERED="end=20,interval=2,pad=0"

Create one new numbered folder with each execution, 3 digit numbering, index is globally remembered:

CreateFolderEx NAME="Season" NUMBERED="start=1,end=1,add=1,pad=3"

Create 5 new folders with each execution, only 1 folder on first use or when no folders exist yet (with that name), index is determined by existing folders:

CreateFolderEx NAME="Season" NUMBERED="start=1,end=1,addexisting=5,pad=3"

Reset global index, do not create any folders:

CreateFolderEx NAME="Season" NUMBERED="reset"

Reset all global indexes, do not create any folders:

CreateFolderEx NUMBERED="resetall"

NUMBEREDASK - Create multiple numbered folders by requesting all necessary details.

Default values in the dialog can be altered by using following options.

Options:

  • start (start index, optional)
  • end (end index, optional)
  • interval (numbering interval, optional)
  • pad (pad numbers with zeros, defaults to "1", disable with "0")

Examples:

Open the NUMBEREDASK dialog:

CreateFolderEx NUMBEREDASK

Open the NUMBEREDASK dialog with a custom default:

CreateFolderEx NAME="My NumFolders" NUMBEREDASK="start=10,end=20,pad=0"

NAME - Folder name or basename (may include path)


PATTERN - Pattern for the final folder name (default is "%name% %num%").


SETTABVAR - Return the created folders (their names) in a tab variable


SETENVVAR - Return the created folders (their names) in an env variable


PT - Pass through options and switches to the native CreateFolder command


Installation:

To install the command, download the *.js.txt file below and drag it to Preferences / Toolbars / Scripts.

Todo:
NUMBERED="resetall" requires NAME argument, though that's not really needed, will be fixed

cya,
tb

Download:

This looks like it might be very useful. Query: Is there a way to have the script store the highest number used in a particular naming sequence so that when called again it can start where it left off? For example, say that I create folders called Mountains 1-10. Then, when I click the button assigned to the script, it would create Mountains 11 or Mountains 11-20.

My feeling is, that this is out of scope of this command, as some lines of script surrounding the given functionality should do what you are requesting. I guess you'd like this to be remembered even if DO is restarted, right?

Rather than store it, couldn't it be worked out quickly from the folders that already exist? The filesystem already stores it.

Unless you're moving the folders to somewhere else and want to continue the numbering sequence. (Consider dated folders instead, perhaps.)

Of course I'd love it to be remembered even when DO is restarted! In my (all to imaginary) perfect world, I'd simply be able to click a button and I'd have a new folder created one number higher than the highest existing folder. Thus, I could have a button for Mountains, Oceans, etc. Click the Mountain button and I'd have Mountain xxx, click it again and I'd have Mountain xxy and so forth.

(For what it's worth, I bought a book on VBscript that I'm going to start working my way through on rainy weekend afternoons...)

@leo
Yes, I thought of that as well. I guess this approach serves a slightly different need, but still a sensible option.

For what you request MSWallack, there needs to be a set of additional switches/options to also allow resetting or deleting specific schemas/series I guess. Else you will pull your hair if the command is going to create the wrong set of folders, because it remembers that you already used that naming scheme last year, while you have long forgotten about it. o)

What about NUMBERED="end=20,add=10,remember" to trigger adding of another 10 folders, while "remember" tells the command to not continue by looking at existing folders, instead look up internal "last index" for the given folderbasename/pattern. And whenever "reset" is given, like in NUMBERED="reset,.. end=10,.." it would first clear/reset its internal counter before kicking loose.
Is that something you/people will understand and use? Any suggestions welcome. Adding folders in chunks also requires padding the number to a predefined number of digits from the first invokation on (to make the numbers format match as long as thinkable).

ps: Please use the VBScript book to heat your home on rainy afternoons and read a decent J(ava)Script introduction instead.
Time and money is spent much better. o)

I can see even more options. Setting a counter for a specific series to avoid creation of folders to just bring that counter up, decreasing an internal counter, after an accidental use etc.. Don't know yet if this all is really hepfull in the long run or if it's going to create more pain than gain.

Updated to v0.2 (while thinking about the recent posts.. o)

  • additional button in the NUMBEREDASK-dialog to edit the naming pattern
  • speedup creating folders by using AddLine() instead of RunCommand()
  • fix for NUMBEREDASK not showing the dialog when no option-values were given

Updated to v0.3 (to stop me from thinking about the recent posts.. o)

  • new NUMBERED options: "set", "add", "addexisting", "reset", "resetall"
  • command label corrected

@MSWallack
Feedback appreciated.. o)

Thanks, tbone. I'll try to play with these some tonight if I can. Unfortunately, weeknights are a bit tricky with a set of teenagers and a puppy to deal with. Sigh.

I don't suppose you could write a script to make the teenagers go to their rooms to do their homework quietly and without screaming at their parents could you? No? Hmm. Too bad. I'd have paid for that script.

Is it possible to change the default button to "Ok" in the NUMBEREDASK dialog? I like to just hit enter after typing the pattern, but with the script as is, it opens the "Set Pattern" dialog when I do so. I thought I might be able to figure it out, but so far it just looks like the first button is always the default. I could make the "OK" button first, but I'd hate to move from the standard dialog box like that.

Updated to v0.4.1:

  • automode
  • suporting (multiple) selections
  • new option "PT" = pass through, to pass arguments through to the native CreateFolder command
  • new option "SETTABVAR"
  • new option "SETENVVAR"
  • default button "OK" instead of "Set Pattern"

@docfallingapart
Here you go. o)

1 Like

Thanks tbone! Sorry I didn't see this sooner, but I'm a total noob on this forum. :confused:

hello just wondering how to set up A-Z folders thank you

so you end up with
A
B
C
and so on

Hi wobbly! o) Unfortunately.. this cannot be done with this.
Just curious, what "number" do you expect to come up after "Z"? o)

well my music is in folders "Atoz" and one more folder for numbers (#) so 27 folders in all
i use the same folder names for some games pics all sots of things

Sounds you only need to create 27 folders each time? Then simply create a button that contains:
CreateFolder "A"
CreateFolder "B"

..and so on?

Couldn't this also be done by creating the folders from a list/clipboard? I think there is a script on the forum for that somewhere.

cool thanks will look at clipboard when i get home

I would like to create folders like:

Season 01
Season 02
Season 03

this works calling the script directly, but my issue is that the dialog has only a checkbox for padding with zero which evaluates to true/false (1/0) so there is no way to do it via the dialog.

Is there a way to modify the dialog to have instead of a checkbox a number field for padding with zeros?