我的文档目录中有一些文件夹和子文件夹,我怎样才能得到一个数组,其中包含目录和子目录中的文件,而不仅仅是文件的文件夹。
到目前为止,这是我的代码,如果不存在文件夹和子文件夹,它可以正常工作
//getting all the files on documents folder in an array.
NSError * error;
NSArray * directoryContents = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:documentsDirectory error:&error];
最佳答案
您可以查看旧的 SO 链接:
关于ios - 获取文档目录 iOS 中的项目数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13706000/