网上下载了视频教程,然后发现文件名太长了。。。然后就想把文件名换掉。。。然后就写了以下的程序。虽然很简单。
package org; import java.io.File; public class DeleteTest { public static void main(String[] args) { String key = ""; if (args.length != 0) { key = args[0]; } File mainFile = new File("E:" + File.separator + "java" + File.separator + "HTML+CSS+JS"); File[] fs = mainFile.listFiles(); for (File f : fs) { String name = f.getName(); int index = name.indexOf(key); name = name.substring(index); System.out.println(name); f.renameTo(new File("E:" + File.separator + "java" + File.separator + "HTML+CSS+JS" + name)); } } }