Skip to content

Instantly share code, notes, and snippets.

@clooth
Created March 28, 2014 11:13
Show Gist options
  • Save clooth/9830409 to your computer and use it in GitHub Desktop.
Save clooth/9830409 to your computer and use it in GitHub Desktop.
NSFileManager *fileManager = [NSFileManager defaultManager];
NSArray *contents = [fileManager contentsOfDirectoryAtPath:directoryPath error:NULL];
NSEnumerator *e = [contents objectEnumerator];
NSString *filename;
while ((filename = [e nextObject])) {
NSString *filePath = [directoryPath stringByAppendingPathComponent:filename];
if ([[filePath pathExtension] isEqualToString:@"jpg"]) {
// jpegitz
[fileManager removeItemAtPath:filePath error:NULL];
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment