批量修改文件夹下文件的名字
生活随笔
收集整理的這篇文章主要介紹了
批量修改文件夹下文件的名字
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
批量修改文件夾下文件的名字
// An highlighted blockpublic static void changeFileNameBatch(String path) {// get file list where the path hastry {File file = new File(path);// get the folder listFile[] array = file.listFiles();for (int i = 0; i < array.length; i++) {String fileName = array[i].getName();System.err.println(i);/* String jp = StringUtils.substringBefore(fileName, "photo0000-");String fileNameSuffix ="photo0000-"+StringUtils.substringAfter(fileName, "photo0000-");String newName = new Translate().convertJptoZh(jp)+fileNameSuffix; */ //新的文件名字 String newName = "";File f_new = new File(path, newName);array[i].renameTo(f_new);}} catch (Exception e) {e.printStackTrace();System.err.println("更改失敗");}}總結
以上是生活随笔為你收集整理的批量修改文件夹下文件的名字的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 家族关系查询系统程序设计算法思路_家族关
- 下一篇: 各种效应和理论