jinfeng_wang

          G-G-S,D-D-U!

          BlogJava 首頁 新隨筆 聯系 聚合 管理
            400 Posts :: 0 Stories :: 296 Comments :: 0 Trackbacks

           

           1package common;
           2
           3import java.io.File;
           4import java.io.IOException;
           5
           6public class RenameFile {
           7 public static void main(String[] args) throws IOException {
           8  String folder = "G:\\shopdata\\\\userdata_bak\\";
           9  renameFileName(new File(folder));
          10  System.out.println("over");
          11 }

          12
          13 private static void renameFileName(File folder) throws IOException {
          14  System.out.println("folder: "+ folder);
          15  File[] files = folder.listFiles();
          16  for (int i = 0; i < files.length; i++{
          17   File file = files[i];
          18   if (file.isDirectory()) {
          19    renameFileName(file);
          20   }
           else {
          21    String oldName=file.getCanonicalPath();
          22    if (oldName.endsWith("html")) {
          23     return;
          24    }

          25    File newName = new File(oldName.replace("aspx""html"));
          26    boolean bool=file.renameTo(newName);
          27    //System.out.println(bool +" : "+newName);
          28   }

          29  }

          30
          31 }

          32}

          33
          34
          posted on 2007-06-11 10:24 jinfeng_wang 閱讀(885) 評論(0)  編輯  收藏 所屬分類: java
          主站蜘蛛池模板: 定州市| 吉水县| 辽阳市| 通州市| 贵南县| 湟源县| 安远县| 彰化县| 台中县| 竹山县| 广丰县| 南和县| 万年县| 定安县| 清徐县| 武乡县| 永和县| 郴州市| 罗田县| 洞头县| 虹口区| 万州区| 渝北区| 万年县| 大安市| 汾西县| 尼勒克县| 定远县| 陵水| 临沧市| 大庆市| 峨眉山市| 淮滨县| 克拉玛依市| 怀柔区| 建湖县| 太白县| 靖州| 栖霞市| 安仁县| 永德县|