1、問題
遍歷某個目錄下的所有問題文件
?
?
?
?
?
?
?
?
?
?
?
2、代碼實現
fun getRecoverTrashFile(path: String) {if (TextUtils.isEmpty(path))returntry {var file = File(path)if (file == null || !file.exists()) {return}var files = file.listFiles()if (files == null || files.size <= 0) {return}for (i in files.indices) {if (files[i].isDirectory) {var path = files[i].absolutePathgetRecoverTrashFile(path)} else {var file = files[i]addTrashFileByPath(file)}}} catch (e: Exception) {LogUtil.i(TAG, "has error")e.printStackTrace()}}