import java.io.File;
public class Xiug {
public static void main(String[] args) {
File infile = new File("D:\\java学习视频\\day07\\day");
File outfile = new File("D:\\java学习视频\\day07");
File[] infileArray = infile.listFiles();
for(File f : infileArray){
if(f.isFile()&&f.getName().endsWith(".avi")){
String fileName = f.getName();
String newFileName = fileName.replace("!", "面向对象");
f.renameTo(new File(outfile,newFileName));
}
}
}
}
|
|