Leandro
Leandro

Reputation: 1096

How to create folder with intermediary folder with Applescript?

I think the question pretty explains what I'm intending to do. I have seen some folder creation scripts on the Internet like this:

tell application "Finder"

    if not (exists folder new_foldername of this_folder) then
        make new folder at this_folder with properties {name:new_foldername}
    end if

end tell

But this script just create one new folder havving its parent folder. I would like something like this Cocoa NSFileManager method

- (BOOL)createDirectoryAtPath:(NSString *)path withIntermediateDirectories:(BOOL)createIntermediates attributes:(NSDictionary *)attributes error:(NSError **)error 

in which I pass a path as parameter and the folder is created within the intermediary directories.

thanks for your attention.

Upvotes: 1

Views: 372

Answers (1)

sakra
sakra

Reputation: 65971

The simplest solution is probably to resort to the mkdir shell command, i.e.:

do shell script "mkdir -p '/path/to/folder/to/create'"

Upvotes: 3

Related Questions