public class ImgFileListScan { private static final String TAG = "FileScan"; public static List<File> getImgFileList(File file) { //scan from DCIM Log.i(TAG, file.getPath()); List<File> fileList = new ArrayList<>(); getFileList(file, fileList); return fileList; } private static void getFileList(File path, List<File> fileList) { //if dir if (path.isDirectory()) { File[] files = path.listFiles(); if (null == files) { return; } for (int i = 0; i < files.length; i++) { getFileList(files[i], fileList); } } else { Log.i(TAG, path.getAbsolutePath()); String filePath = path.getAbsolutePath(); fileList.add(new File(filePath)); } } }
Android文件扫描
最新推荐文章于 2024-09-07 10:12:54 发布