开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜