Skip to content

Instantly share code, notes, and snippets.

@clooth
Created March 28, 2014 11:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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