Cocoa 如何使用Applescript创建具有中间文件夹的文件夹?

Cocoa 如何使用Applescript创建具有中间文件夹的文件夹?,cocoa,applescript,directory,Cocoa,Applescript,Directory,我认为这个问题很好地解释了我打算做什么。 我在Internet上看到过一些文件夹创建脚本,如下所示: 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 但是这个脚本只创建一个

我认为这个问题很好地解释了我打算做什么。 我在Internet上看到过一些文件夹创建脚本,如下所示:

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
但是这个脚本只创建一个新文件夹,它有它的父文件夹。我想要类似于此的文件管理器方法

- (BOOL)createDirectoryAtPath:(NSString *)path withIntermediateDirectories:(BOOL)createIntermediates attributes:(NSDictionary *)attributes error:(NSError **)error 
在其中,我将路径作为参数传递,并在中间目录中创建文件夹


感谢您的关注。

最简单的解决方案可能是使用shell命令,即:

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

实际上,这是我正在使用的解决方法,但它仍然是一个解决方法。不管怎么说,投票支持你=)这确实是最简单的解决方案。纯Applescript版本需要解析给定的路径,逐文件夹构建路径,直到所有内容都被排序和创建。对于Applescript,这需要很多代码<代码>mkdir是一行代码,它可以工作。听到这个消息很抱歉。恐怕这是正确的解决方案,所以。谢谢你们的帮助,伙计们。