I try to delete all files including subdirectories in a folder:
NSFileManager *deleteMgr = [NSFileManager defaultManager];
NSString *path = @"~/test/";
[deleteMgr removeItemAtPath:path error:&error];
And it deletes everything including the folder itself.
But what I expect is an empty folder.
Could anyone please help me what did I do wrong?
Really thanks your help! 🙂
You should call contentsOfDirectoryAtPath on the directory in question, and then use removeItemAtPath on all of the paths it returns.