Create Directory with Multiple subs?

Discuss and share scripts and script files...
Post Reply
fuego126
Posts: 6
Joined: 25 May 2019 23:50

Create Directory with Multiple subs?

Post by fuego126 » 26 May 2019 00:07

Hi.. .wondering if someone can lead me down the right path.... I want to create a button that will:

a) ask the user for a folder name (ie: Marybeth) And then
1 - create the folder in a specific path (ie: G:\clients\Marybeth)
2 - change to that new directory and create 3 fixed subdirectories (ie: G:\clients\Marybeth\Images, \Text, \Previews)

Thus, at the end of the click, there would be a new G:\clients folder with the 3 subfolders.... I got part way into this but not any further. Thx!

highend
Posts: 8152
Joined: 06 Feb 2011 00:33

Re: Create Directory with Multiple subs?

Post by highend » 26 May 2019 00:09

And your "part way" looks like?...
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

fuego126
Posts: 6
Joined: 25 May 2019 23:50

Re: Create Directory with Multiple subs?

Post by fuego126 » 26 May 2019 00:17

I was able to get the input box to appear and create the new folder....

Code: Select all

input $name, "Enter the name of the new folder to create";
 new "<curpath>\$name", dir;
But - I was not able to force it to a specific path (ie: G:\clients) nor could I find the chg directory command... thx for your advice!

highend
Posts: 8152
Joined: 06 Feb 2011 00:33

Re: Create Directory with Multiple subs?

Post by highend » 26 May 2019 00:27

This is way off...

Code: Select all

    $dstPath = "R:\test";
    $subFolders = "Images|Text|Previews";

    $folderName = input("Enter the desired folder name");
    if ($folderName) {
        foreach($subFolder, $subFolders, , "e") {
            new("$dstPath\$folderName\$subFolder", "dir");
        }
        goto "$dstPath\$folderName";
    }
One of my scripts helped you out? Please donate via Paypal or highend (at) web (dot) de

fuego126
Posts: 6
Joined: 25 May 2019 23:50

Re: Create Directory with Multiple subs?

Post by fuego126 » 26 May 2019 22:47

Thx HighEnd... that did the trick. Appreciate the time..... :beer:

Post Reply