import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
public class RollDateFile {
public static void rename(File f,String old_v,String new_v ){
if(f.isDirectory()){
for(File file :f.listFiles()){
rename(file,old_v,new_v );
}
}else{
String path = f.getParent();
String newFile = (f.getName()+"").replaceAll(old_v,new_v);
String newF = path+File.separator+newFile;
System.out.println(newF);
f.renameTo(new File(newF));
}
}
/**
* @param args
* @throws Exception
*/
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
String path ="E:\\a\\";
String old_value ="20120828";
String new_value ="20130124";
File folder = new File(path);
rename(folder,old_value,new_value);
}
}