资源说明: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());
}
}
本源码包内暂不包含可直接显示的源代码文件,请下载源码包。