.svnファイル削除2
1438 ワード
.svnファイル削除
package com.aixin.control;
import java.io.File;
public class DeleteSvnFile {
public static void deleteDirectory(String dest)
{
File f = new File(dest);
if (f.exists())
{
if (f.isDirectory())
{
File[] fs = f.listFiles();
if (fs.length > 0)
{
for (File file : fs)
{
deleteDirectory(file.getAbsolutePath());
}
}
}
f.delete();
}
}
public static void deleteSvnFile(String path) {
File root = new File(path);
File[] files = root.listFiles();
for(int i=0;i<files.length;i++) {
String _subFileName = files[i].getName();
if(_subFileName.equals(".svn")){
System.out.println(files[i].getPath());
deleteDirectory(files[i].getPath());
}
if(files[i].isDirectory()){
deleteSvnFile(files[i].getPath());
}
}
}
public static void main(String[] args) {
String path = "D:/Workspaces/MyEclipse 9/test"; // .svn
deleteSvnFile(path);
}
}