清除目录下的文件 java
/** * clear redundant files */ public static void clearRedundantFiles() { String path = "/data/update/"; File file = new File(path); if (!file.exists()) { return; } File fileList[] = file.listFiles(); for (int i = 0; i < fileList.length; i++) { File fileNode = fileList[i]; if (fileNode.isDirectory()) { continue; } String fileName = fileNode.getName(); if (fileName.startsWith("meminfo")|| fileName.startsWith("cpuinfo")) { Log.info(TAG, "clearRedundantFiles " + path + fileName); File fileObj = new File(path + fileName); fileObj.delete(); } } }