1 String path= ApplicationConfigure.getProperty("rootPath"); 2 clearFiles(path+File.separator+id); 3 //删除磁盘上文件和目录 4 private void clearFiles(String workspaceRootPath){ 5 File file = new File(workspaceRootPath); 6 deleteFile(file); 7 } 8 9 private void deleteFile(File file){ 10 if(file.exists()){ 11 if(file.isDirectory()){ 12 File[] files = file.listFiles(); 13 for(int i=0; i<files.length; i++){ 14 deleteFile(files[i]); 15 } 16 } 17 } 18 file.delete(); 19 } 20