import java.io.File;
public class DeleteCvsFile {
public static void main(String[] args) {
String filepath = "D:/workspace_java/yp";
if(args.length > 0) filepath = args[0];
File file = new File(filepath);
delCvs(file);
}
static void delCvs(File file) {
if(file.getName().equals("CVS")) {
System.out.println("delete: " + file.getAbsolutePath());
delDir(file);
return ;
}
if(file.isDirectory()) {
File[] files = file.listFiles();
for(int i=0; i != files.length; ++i) {
delCvs(files[i]);
}
}
}
static void delDir(File file) {
if(file.isDirectory()) {
File[] files = file.listFiles();
for(int i=0; i != files.length; ++i) {
delDir(files[i]);
}
}
file.delete();
}
}
Monday, June 1, 2009
remove cvs folders. [java]
just as a reminder~
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment