在制作个人播放器的时候,需要遍历本地音乐文件夹,于是知道了遍历文件的方法,现记录如下,方便日后查找
NSArray *fileList = [[NSFileManager defaultManager] directoryContentsAtPath:deskPath]; //遍历路径下所有文件
NSArray *fileList = [[[NSFileManager defaultManager] directoryContentsAtPath:DOCUMENTS_FOLDER]
pathsMatchingExtensions:[NSArray arrayWithObject:@"png"]] ; // 遍历后缀为png的文件