import java.io.*; public class test { public void reName(String path, String from, String to) {
File f = new File(path);
File[] fs = f.listFiles(); for (int i = ; i < fs.length; ++i) {
File f2 = fs[i]; if (f2.isDirectory()) {
reName(f2.getPath(), from, to);
} else {
String name = f2.getName();
if (name.endsWith(from)) {
f2.renameTo(new File(f2.getParent() + "/" + name.substring(, name.indexOf(from)) + to));
}
}
}
}
public static void main(String[] args) {
test rf = new test();
rf.reName("C:/Documents and Settings/xxxxx/Desktop/astaxie", ".md",".txt");
}
}