Created
December 11, 2013 08:57
-
-
Save hartbit/7907108 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSFileManager* fileManager = [NSFileManager new]; | |
NSURL* directoryURL = [NSURL fileURLWithPath:@"~/photos"]; | |
NSArray* contents = [fileManager contentsOfDirectoryAtURL:directoryURL includingPropertiesForKeys:@[] options:NSDirectoryEnumerationSkipsHiddenFiles error:NULL]; | |
NSPredicate* predicate = [NSPredicate predicateWithFormat:@"pathExtension == 'jpg' OR pathExtension == 'jpeg'"]; | |
for (NSURL* fileURL in [contents filteredArrayUsingPredicate:predicate]) { | |
NSURL* rawFileURL = [[fileURL URLByDeletingPathExtension] URLByAppendingPathExtension:@"raw"]; | |
if (![fileManager fileExistsAtPath:[rawFileURL path]]) { | |
[fileManager removeItemAtURL:fileURL error:NULL]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment