commons-io。jar
实现文件的拷贝并且重命名操作
@Test
public void testCopyFiles() {
File file = new File("d:/lucene/example/");
for(File f:file.listFiles()) {
String destFileName = FilenameUtils.getFullPath(f.getAbsolutePath())+FilenameUtils.getBaseName(f.getName())+".ini";
try {
FileUtils.copyFile(f, new File(destFileName));
} catch (IOException e) {
e.printStackTrace();
}
}
}