如何search目录ios

我想知道如何检查一个目录是否存在于我的应用程序中

例如:如果我想search我的应用程序文档中是否存在文件夹

以及如何在其中创build一个新的文件夹

最好的祝福

检查文件是否存在:

+(BOOL)fileExistsAtAbsolutePath:(NSString*)filename { BOOL isDirectory; BOOL fileExistsAtPath = [[NSFileManager defaultManager] fileExistsAtPath:filename isDirectory:&isDirectory]; return fileExistsAtPath && !isDirectory; } 

检查目录是否存在:

 +(BOOL)directoryExistsAtAbsolutePath:(NSString*)filename { BOOL isDirectory; BOOL fileExistsAtPath = [[NSFileManager defaultManager] fileExistsAtPath:filename isDirectory:&isDirectory]; return fileExistsAtPath && isDirectory; }