文件名称:删除svn文件的java代码
文件大小:961B
文件格式:TXT
更新时间:2016-01-11 10:02:18
删除 svn java
代码很简单,可能不太友好,但是可以用 import java.io.File; public class Test { public static void main(String[] args) { File directory = new File("D://workspace//代码文件夹名称"); deleteSvnDirectory(directory); } public static void deleteSvnDirectory(File directory) { if (".svn".equals(directory.getName())) { deleteDirectory(directory); } else { for (File file : directory.listFiles()) { if (file.isDirectory()) { deleteSvnDirectory(file); } } } } public static void deleteDirectory(File directory) { for (File file : directory.listFiles()) { if (file.isDirectory()) { deleteDirectory(file); } else { if (file.delete()) { System.out.println("删除文件成功:" + file.getAbsolutePath()); } else { System.out.println("删除文件失败:" + file.getAbsolutePath()); } } } directory.delete(); System.out.println("删除目录成功:" + directory.getAbsolutePath()); } }