1 package com.hxl; 2 3 import java.io.File; 4 5 public class Test { 6 public static void main(String[] args) { 7 String str = "E:\\工作学习\\计算机杂类\\Java Web开发\\javascript & jQuery精品教程视频\\jQuery\\第3天\\"; 8 File file = new File(str); 9 File[] files = file.listFiles(); 10 for (File f : files) { 11 String num = f.getName().substring(0, 2); 12 String ss = f.getName().substring(3); 13 f.renameTo(new File(str + "第" + num + "讲:" + ss)); 14 } 15 } 16 }