How to search for ios directories

I want to know how to check if a directory exists in my application

for example: if I want to search if a folder exists in the application document

and how to create a new folder in it

Best wishes

+6
ios objective-c
source share
1 answer

Check file availability:

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

Checking for a directory:

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

All Articles