Rocky
Rocky

Reputation: 1423

how to create subfolder in document directory in iphone

how to create another folder in document directory and then .I want to pass some file in that folder which is create in document directory then i want to make this folder as zip file

please help me on this how to work on this

Upvotes: 4

Views: 1739

Answers (1)

iArezki
iArezki

Reputation: 1271

try this

NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
NSString *documentsDirectory = [paths objectAtIndex:0]; 
NSString *dataPath = [documentsDirectory stringByAppendingPathComponent:@"/yourFolderName"];

if (![[NSFileManager defaultManager] fileExistsAtPath:dataPath])
[[NSFileManager defaultManager] createDirectoryAtPath:dataPath withIntermediateDirectories:NO attributes:nil error:&error];

Upvotes: 6

Related Questions