objective c - Deleteing more than one file from iphone documents folder? -


my iphone application saving photos document folder. want delete these file form document folder after use. know how delete 1 file @ time using path

if ([filemgr removeitematpath:filepath error:&error] != yes)     nslog(@"unable delete file: %@", [error localizeddescription]); 

but want delete file in 1 go. files in .png format tried out *.png not working.

/* dir: directory files */ nsfilemanager *fm = [nsfilemanager defaultmanager]; nserror *error = nil; nsarray *items = [fm contentsofdirectoryatpath:dir error:&error]; if (error) { /* ... */ }  /* delete png files */ (nsstring *item in items) {     if ([[item pathextension] isequaltostring:@"png"]) {         nsstring *path = [dir stringbyappendingpathcomponent:item];         [fm removeitematpath:path error:&error];         if (error)             { /* ... */ }     } } 

Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

php - How can I edit my code to echo the data of child's element where my search term was found in, in XMLReader? -