Create folder based on filename with a twist

Example. Let's say I have the following picture files:

pron-set01-001.jpg
pron-set01-002.jpg
pron-set01-003.jpg
pron-set02-001.jpg
pron-set02-002.jpg
pron-set02-003.jpg

Would it be possible for a button script to:

  1. Popup a box asking how many characters from left for folder name output
  2. Enter 10 for above example, which would create two folders named pron-set01 and pron-set02 based on the sequential changing of digits
  3. Create the folders and automatically move the image files into the new folders

Possible? :slight_smile:

Making it ask you to input a number and use that would probably require some VBScript but the regular expression to replace the Nth character with a \ is fairly easy to type each time:


quote="xphil3"Would it be possible for a button script to:

  1. Popup a box asking how many characters from left for folder name output
  2. Enter 10 for above example, which would create two folders named pron-set01 and pron-set02 based on the sequential changing of digits
  3. Create the folders and automatically move the image files into the new folders
    Possible? :slight_smile:[/quote]

Of course it is possible :smiley:

  1. Extract and copy the attached (SplitCopy.vbs) to /dopusdata\scripts folder
  2. Create a key with following code:

@set split={RS|Enter your split number} @nofilenamequoting {A|dopusdata}\scripts\SplitCopy.vbs "{$split}" "{o}" "{s}"

Enjoy it :wink:

I'm sorry :blush: My previous code have a little bug. Please use the new attached code.
SplitCopy.zip (683 Bytes)

Both are great solutions! You guys rock. :smiley:

searcher123,
this is such a great script.
Thank you very, very much!

Now is there a way to make it a little more robust?
I mean, I don't want to sound insatiable or unthankful-

but this feature so awesome that I think it deserves a second look:

I use it to sort many files (naturally...) which takes lots of time.
But changing source or destination folder is not a good idea at the moment,
as the script will simply copy the files into the new destination instead of the first selected one.

Is there a way to have the script remember its sources and destination,
so that we can still work with Dopus during the procedure.

Best regards,
D.

[quote="Debby747"]searcher123,
this is such a great script.
Thank you very, very much!

Now is there a way to make it a little more robust?
I mean, I don't want to sound insatiable or unthankful-[/quote]

You are welcome!, I'm very pleased my code was useful for you.
This forum is established for helping to each other, be comfortable to tell about your needs :slight_smile:

Of course yes, but just with an external Copy command (e.g. Windows internal Copy) I think.

My code used DOpusrt and I don't know if DOpusrt can work in parallel with DOpus or not. Answering to the question is Leo proficiency and I'm sure he will share another part of his knowledge about DOpus with us :slight_smile:

Regards

I tested and I found that DOpusrt can work in parallel too. So I changed my code. It worked for me. Please replace previous code with the attached and use the following code in y our key:

@set split={RS|Enter your split number} @nofilenamequoting {A|dopusdata}\scripts\SplitCopy_v1.1.vbs "{$split}" "{o}" "{s}" "{d}"

The only problem is DOpusrt progress bar. I cannot disable it! :confused:

Best Regards
SplitCopy_v1.1.zip (739 Bytes)

You can simplify things by removing @nofilenamequoting and removing the quotes around the arguments to the script, except for the {$split} argument:

@set split={RS|Enter your split number} {A|dopusdata}\scripts\SplitCopy_v1.1.vbs "{$split}" {o} {s} {d}

(The {$split} argument doesn't really need quotes either since you'll always type a number, without spaces, but it's good to always put quotes around {RS|...} inputs so you don't forget in cases where they are needed.)

During writting previous codes, I was forgot a featured called Space trimming in DOpus. In the feature, when you enter a name with additional space at the beginning or at the end, the space will be trimmed automatically.

In consequence of this feature, if your splitting number take placed exactly on a space at your file name, your dir on destination will be created without any space at the beginning/end automatically and so you will received an error of DOpus that say "the path not found".

For Example, if you have a file named "This is a test.jpg" and enter 5, 8 or 10 for splitting, the error will be appeared. Now, this feature is recognized by my code.

Don't forget to change the name of "SplitCopy_v1.1.vbs" to "SplitCopy_v1.2.vbs" in your key too.

Regards
SplitCopy_v1.2.zip (770 Bytes)

You guys are fabulicious :smiley:

Many thanks,
D.

After all the work you had,
I thought I'd better tell you that your new script makes me happy :slight_smile:

I can just ignore the ongoing procedure and even copy or move other files to heart's content without interfering with it.

Just one more observation:
I am glad it is not a move but a 'copy to' function...

Have a great first advent!
D.

Following this topic, I used the vbscript and made slight changes on how it works....

The script and user command are improved to be able to use it on DOpus portable installs (dopusrt fixed path was the problem, it's now dynamically assigned following your install path).

Also, I created a user command to be able to use different switches to change the command behaviour. You can now Copy or move, use the command on a single lister with the SAMEDEST switch, and also choose if you want to split the names or not.

A txt file is included in the zip to explain switches usage.

@searcher123:
I changed script version to v1.21 and also put some comments at the beginning of the script to get an overview of the changes.
you should probably put this as a toolbar & buttons new topic... I'm sure a lot of persons would find it useful, and it'd be easier to find it I guess.
SplitCopy_v1.21.zip (2.02 KB)

Just to notification: As far as I know, /dopscripts is not a built-in DOpus alias, so if you receive an error message, change it to [b]{A|dopusdata}scripts[/b].

[quote="GoinPostal"]@searcher123:(...)
(...)you should probably put this as a toolbar & buttons new topic(...)[/quote]

I'm sorry, but I will not sent any more enhancement code/app to the site.

Regards

oops, I thought I changed that before posting!
yeah, I created this /dopscripts alias so it's a little shorter and easier way to call scripts & apps from this folder.

By the way, I haven't told, this is a nice script, I haven't thought about that before as automatic folder naming, this is great!

[quote="searcher123"]...
I'm sorry, but I will not sent any more enhancement code/app to the site.
[/quote]

Don't be sorry, you have your own good reasons for that!

Best regards and thanks for the script!!

That'd be this (and we were/are especially against someone who we know is (still!) a pirate user posting compiled .exe scripts to the site that we couldn't see the source of).

That'd be this (and we were/are especially against someone who we know is (still!) a pirate user posting compiled .exe scripts to the site that we couldn't see the source of).[/quote]

Oh, ok then, I didn't thought about this!