public static void main(String[] args) {
String path = "G:/工作/test";
File file = new File(path);
System.out.println(file.exists());
File[] files = file.listFiles();
if (null != files && files.length > 0) {
for (File file1 : files) {
if (file1.isFile()) {
String absolutePath = file1.getAbsolutePath();
System.out.println(absolutePath);
String temp = "测试";
if (absolutePath.contains(temp)) {
String replace = absolutePath.replace(temp, "test");
File file2 = new File(replace);
file1.renameTo(file2);
}
}
}
}
}