Create Seasons Button

Hi,

I was wondering if someone could help.

I'm currently ripping all my TV box sets and having to manually create sub folders Season 0 up to the highest Season for that particular show.

Is it possible to create a button called Create Seasons which will ask for the number of Seasons to create and then automatically create folders called Season 0 up to the number entered when I pressed the button.

Thanks in advance.

John

I would use this code to start with:

Then change the Folder Name,1,20 on the first line to something like Season,0,7. The first number is the starting 0 you wanted. The last number is the last folder you want. The changes made to the first line are the defaults that appear in the dialog, so make them relevant to your needs.

Example:

Rename FILEINFO FROM="." TO="{DlgStringS|Create Season folder range:|Season,0,7}" 

Now go to intPadTo = 3

Change the 3 to a 2 or 1, depending on if you want 00 or 0. I like my Season folders to have 2 digits (01, 02, 03 etc), so I would use intPadTo = 2

Now every time you click the button, you just need to change the last number (7 in my above example) to the ending folder you want. If you don't want the text in the dialog to be selected by default, remove the S from DlgStringS on the first line.

What I also like about this script is that, if a folder already exists with the same name, it skips it without error and continues.

Hope that's a good starting point for you. I have no idea how to change the code to only ask for an ending number.

Here is a ready to use variant, it does not pad the numbers yet:

<?xml version="1.0"?> <button backcol="none" display="both" textcol="none"> <label>Create numbered Folders</label> <icon1>#makedir</icon1> <function type="script"> <instruction>@script jscript</instruction> <instruction /> <instruction>function OnClick(data){</instruction> <instruction> var result = DOpus.Dlg.GetString(&quot;Enter folder basename and highest index.\nExample: \&quot;Demo Folders 10\&quot;&quot;,</instruction> <instruction> &quot;&quot;,</instruction> <instruction> 255,</instruction> <instruction> &quot;Ok|Cancel&quot;,</instruction> <instruction> &quot;Create numbered Folders&quot;);</instruction> <instruction> if (!result) return;</instruction> <instruction> var parts = result.split(&quot; &quot;);</instruction> <instruction> var max = parts[parts.length-1]*1;</instruction> <instruction> parts.pop();</instruction> <instruction> var folderBase = parts.join(&quot; &quot;);</instruction> <instruction> for(var i=1;i&lt;=max;i++){</instruction> <instruction> var cmd = &apos;CreateFolder &quot;&apos;+folderBase+&apos; &apos;+i+&apos;&quot;&apos;;</instruction> <instruction> data.func.command.RunCommand(cmd);</instruction> <instruction> }</instruction> <instruction>}</instruction> </function> </button>

Thank you very much.. Much appreciated.

John

An evolution to my script button posted before..

  • supports start/end index
  • supports intervals (only create even/odd or every fifth folder)
  • supports automatic padding of the numbers with zeros

CreateNumberedFolders.dcf (4.28 KB)
Looks like so:

Thanks tbone.. :smiley:

Do you mind if I edit it for my own use.

John

Of course not! o) But I'm curious.. what is it you don't like or add to it? o)

Hi,

I like your script. Just looking for dialogue to open and ask for the number of seasons then automatically create folders called Season 0 up to the number I entered in the dialogue. Ie the name season is hard coded in the script along with the initial value of zero.

John

Well, in this case.. o)
I recommend this new script addin, "CreateFolderEx": Command: CreateFolderEx (extended CreateFolder command)

It features the same dialog as shown above (the script button), but also allows pre-initialization. The new command also has a regular command line mode, which can be used in conjunction with {dlgstring} to fill in only specific parameters.

Only requesting end-index:

CreateFolderEx NAME="Season" NUMBERED="start=0,end={dlgstring|Enter end:|5}"

Using the full dialog, pre-initialized to your use case:

CreateFolderEx NAME="Season" NUMBEREDASK="start=0"

nicely done (again), tbone :thumbsup:

Thanks tbone :thumbsup:

With version v0.3 of CreateFolderEx, you can add a single new folder to an existing set of folders.
I guess clicking a button a few times is faster than editing a number in a dialog that needs cofirmation as well.
This command adds a new folder to a set of existing "Season xx" folders or creates the first folder of the series.

CreateFolderEx NAME="Season" NUMBERED="end=1,addexisting=1"

Wrapped into a quick demo button:

<?xml version="1.0"?> <button backcol="none" display="both" textcol="none"> <label>CNF AddExisting</label> <icon1>#makedir</icon1> <function type="normal"> <instruction>CreateFolderEx NAME=&quot;Season&quot; NUMBERED=&quot;end=1,addexisting=1&quot;</instruction> </function> </button>

Fantastic tbone :thumbsup:

[quote="tbone"]With version v0.3 of CreateFolderEx, you can add a single new folder to an existing set of folders.
I guess clicking a button a few times is faster than editing a number in a dialog that needs cofirmation as well.[/quote]
That is really cool. Thank you, tbone.