Skip to content

Instantly share code, notes, and snippets.

@githubutilities
Created September 11, 2015 01:59
Show Gist options
  • Select an option

  • Save githubutilities/628a46b6c171771009de to your computer and use it in GitHub Desktop.

Select an option

Save githubutilities/628a46b6c171771009de to your computer and use it in GitHub Desktop.
File Worker Objective C

File Worker Objective C

// File Worker
NSFileManager *manager = [NSFileManager defaultManager];
NSString *home = [@"~" stringByExpandingTildeInPath];
NSMutableArray *files = [NSMutableArray arrayWithCapacity:40];

for (NSString *filename in [manager enumeratorAtPath:home]) {
    if ([[filename pathExtension] isEqual:@"png"]) {
        [files addObject:filename];
    }
}

for (NSString *filename in files) {
    NSLog(@"%@", filename);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment