[b]简单的删除.svn目录工具。放在博客上方便自己找到。[/b]
import java.io.File;
public class DeleteSvn {
private static String path = "D:/product";
private static String pattern = ".svn";
public static void main(String args[]) {
File rootDirctory = new File(path);
deleteSVN(rootDirctory);
}
/**
*
* @Title deleteSVN
* @Description: 删除后缀名为.svn的文件夹
* @param input
* @return void
*/
public static void deleteSVN(File input) {
if (input.isDirectory()) {
for (File dirctory : (input.listFiles())) {
if (dirctory.isDirectory()) {
System.out.println("Now dirctory is "
+ dirctory.getAbsoluteFile());
if (dirctory.getName().equalsIgnoreCase(pattern)) {
deleteFiles(dirctory);
System.out.println("To be deleted "
+ dirctory.getAbsoluteFile() + "-->"
+ dirctory.delete());
// dirctory.
} else {
deleteSVN(dirctory);
}
}
}
}
}
/**
*
* @Title deleteSVN
* @Description: 删除文件夹下的所有文件和文件夹
* @param input
* @return void
*/
public static void deleteFiles(File input) {
if (input.isDirectory()) {
for (File dirctory : (input.listFiles())) {
if (dirctory.isDirectory()) {
deleteFiles(dirctory);
}
dirctory.delete();
}
} else {
input.delete();
}
}
}