2010-10-07 86 views

回答

4

使用createDirectoryAtPath:withIntermediateDirectories:attributes:error:

附:

createIntermediates If YES, then the method will also create any necessary intermediate directories; if NO, then the method fails if any parent of the directory to be created does not exist. In addition, if you pass NO for this parameter, the directory must not exist at the time this call is made.

+0

你会传递给'withIntermediateDirectories'你能通过零吗?它有什么作用? – 2010-10-07 10:43:58

+0

用参考报价更新了答案;) – Vladimir 2010-10-07 10:45:52

+0

啊我看到了...所以如果你有一个你想要创建的文件夹的路径如下:* Documents/A/Directory/In/Here *并且你将'withIntermediateDirectories'设置为NO那么如果任何目录* A *,* Directory *和* In *都不存在,它将会失败。如果是,那么它会创建它们,如果它们不存在?辉煌。谢谢。 – 2010-10-07 10:53:39