how to delete all files in a folder, but not the folder itself?
Posted
by Frost Li
on Stack Overflow
See other posts from Stack Overflow
or by Frost Li
Published on 2010-06-17T22:14:52Z
Indexed on
2010/06/17
22:33 UTC
Read the original article
Hit count: 192
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! :)
© Stack Overflow or respective owner