2010-10-07 84 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