Page 1 of 1

Create Directory with Multiple subs?

Posted: 26 May 2019 00:07
by fuego126
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!

Re: Create Directory with Multiple subs?

Posted: 26 May 2019 00:09
by highend
And your "part way" looks like?...

Re: Create Directory with Multiple subs?

Posted: 26 May 2019 00:17
by fuego126
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!

Re: Create Directory with Multiple subs?

Posted: 26 May 2019 00:27
by highend
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";
    }

Re: Create Directory with Multiple subs?

Posted: 26 May 2019 22:47
by fuego126
Thx HighEnd... that did the trick. Appreciate the time..... :beer: