package com.david4;
import java.io.File;
/**
*
* @author 韩晓军
*
*/
public class SvnDelete {
private static String path = "E:\\svn source\\cc";
public static void main(String[] args) {
File file = new File(path);
delete(file);
}
public static void delete(File file) {
if (file != null && file.isDirectory()) {
if (file.getName().equals(".svn")) {
deleteFolder(file);
}
File[] files = file.listFiles();
if (files != null && files.length > 0) {
for (int i = 0; i < files.length; i++) {
if (files[i].isDirectory()) {
if (files[i].getName().equals(".svn")) {
deleteFolder(files[i]);
} else {
delete(files[i]);
}
}
}
}
}
}
public static void deleteFolder(File file) {
if (file != null && file.isDirectory()) {
File[] files = file.listFiles();
if (files.length > 0) {
for (int i = 0; i < files.length; i++) {
if (files[i].isFile()) {
System.out.println(files[i].getPath());
files[i].delete();
} else if (files[i].isDirectory()) {
deleteFolder(files[i]);
}
}
}
}
System.out.println(file.getPath());
file.delete();
}
}
删除svn文件
最新推荐文章于 2022-08-18 16:15:38 发布