Create NSArray of a folder subpaths
Is there a core method to create开发者_C百科 an array representation of a folder?
I mean something like[
folder1[
001.jpg,
002.jpg
],
folder2[
subfolder1[
001.jpg
002.jpg
],
]
folder3[
001.jpg
]
]
I'm using subpathsAtPath to get an array of a single folder: should I loop across all subfolders or is there a smarter way?
NSArray* fileNames = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:path error:&outError];
You may be better of with enumeratorAtPath:, you can then enumerate through decedents and use NSDirectoryEnumerator to get level.
精彩评论