Revision: 26202
Updated Code
at April 20, 2010 13:51 by BenClayton
Updated Code
+(NSArray*)arrayOfFoldersInFolder:(NSString*) folder { NSFileManager *fm = [NSFileManager defaultManager]; NSArray* files = [fm directoryContentsAtPath:folder]; NSMutableArray *directoryList = [NSMutableArray arrayWithCapacity:10]; for(NSString *file in files) { NSString *path = [folder stringByAppendingPathComponent:file]; BOOL isDir = NO; [fm fileExistsAtPath:path isDirectory:(&isDir)]; if(isDir) { [directoryList addObject:file]; } } return directoryList; }
Revision: 26201
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at April 20, 2010 13:42 by BenClayton
Initial Code
- (ViewController *) init { if (self = [super init]) self.title = @"Text Files"; // get the list of all files and directories NSFileManager *fM = [NSFileManager defaultManager]; fileList = [[fM directoryContentsAtPath:DOCUMENTS_FOLDER] retain]; NSMutableArray *directoryList = [[NSMutableArray alloc] init]; for(NSString *file in fileList) { NSString *path = [DOCUMENTS_FOLDER stringByAppendingPathComponent:file]; BOOL isDir = NO; [fM fileExistsAtPath:path isDirectory:(&isDir)]; if(isDir) { [directoryList addObject:file]; } } NSLog(@"%@", directoryList); return self; }
Initial URL
Initial Description
Initial Title
get all / list all folders in directory
Initial Tags
Initial Language
Objective C