Last active
October 7, 2017 18:13
-
-
Save fallenleavesguy/4c578c318a1fae9a88bf206b6ae7d27d to your computer and use it in GitHub Desktop.
recursive search jpg file in home.m
This file contains hidden or 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
#import <Foundation/Foundation.h> | |
int main(int argc, const char * argv[]) { | |
NSLog(@"beginning search..."); | |
@autoreleasepool | |
{ | |
NSFileManager *manager = [NSFileManager defaultManager]; | |
NSString *home = [@"~" stringByExpandingTildeInPath]; | |
NSMutableArray *files; | |
files = [NSMutableArray arrayWithCapacity:42]; | |
for (NSString *filename in [manager enumeratorAtPath:home]) | |
{ | |
if ([[filename pathExtension] isEqualTo:@"jpg"]) | |
{ | |
[files addObject:filename]; | |
} | |
} | |
for (NSString *filename in files) | |
{ | |
NSLog(@"%@", filename); | |
} | |
} | |
NSLog(@"ending search..."); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment