java 文件夹重命名

java 文件夹重命名,第1张

package com.nokia

import 蠢源java.io.File

/*

 * This is class used for rename the whole file under file folder name*/

public class RenameFile {

 public static void main(String args[]) {

 /*

  * you should change the path E://文件夹  to what you have on your own 戚茄computer!*/

  File fl = new File("E://文件夹")  //这里写上发替换的文件夹路径,注意使用双斜杠

  String[] files = fl.list()

  File f = null

  String filename = ""

  for(String file:files){

   f = new File(fl,file)//注意,这里一定要写成File(fl,file)如果写成File(file)是行不通的,一定要全路径

   filename = f.getName()

   // System.out.println(filename)

   /*the string 要替换掉的内容 is the content in your own file string with the name 替换成的内容, 

    * here you should change the string into what you have.*/

   f.renameTo(new File(fl.getAbsolutePath() + "//" + filename.replace("要替换掉的内容", "替换成的内容")))//这里可以反复使用replace替换,当然也可以使用正则表达式来替换了高档察

   

  }

 }

}

首先,按Win+E打开文件管理器

然后双脊喊和击E盘打开E盘

然后按Ctel+Shift+N新建文樱盯件夹

在之后输入“java”即可

如果已经失焦,可以选中新建的文件夹

然后按F2或者在单击一下,就可以重命名渗世了

1.右键埋禅model 然后选择refactor-->rename--->选谈大择rename module-->ok

2.file-->project structure-->修改name为新model名

3.修改pom文件中旧项目名替换为新项弯侍尘目名

4.修改文件名,刷新项目OK


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/tougao/12298969.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-05-24
下一篇 2023-05-24

发表评论

登录后才能评论

评论列表(0条)

保存