i am trying to delete all the files in the Document Directory with the extension ".jpg", after many tries, i am still not managed to succeed.
the code i have already now is:
-(void)removeOneImage:(NSString*)fileName {
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
NSString *documentsDirectory = [paths objectAtIndex:0];
NSString *fullPath = [documentsDirectory stringByAppendingPathComponent:[NSString stringWithFormat:@"%@.jpg", fileName]];
[fileManager removeItemAtPath: fullPath error:NULL];
}
with this code i can remove one file with a specific name.
Can anyone help me to remove all files with a specific extension?
Kind regards,
Snowy