java 如何用ANT重命名n个文件?(批处理作业)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4224995/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 05:23:26  来源:igfitidea点击:

How to rename n files with ANT? (Batch Job)

javaantbatch-processing

提问by Thomas Zuberbühler

How can I rename 1..n file with ANT? I would like to rename any files with xxxx.default.propertiesto xxxx.local.properties.

如何使用 ANT 重命名 1..n 文件?我想与重命名的文件xxxx.default.propertiesxxxx.local.properties

Thank you.

谢谢你。

回答by OscarRyz

Using the movetask you could do something like this:

使用移动任务,您可以执行以下操作:

  <move todir="my/src/dir" includeemptydirs="false">
    <fileset dir="my/src/dir"/>
    <mapper type="glob" from="*.default.properties" to="*.local.properties"/>
  </move>

Give it a try and let us know.

试一试,让我们知道。

回答by KingCrunch

Use the move-task. There is also an example how to rename a set of files (last examples).

使用移动任务。还有一个如何重命名一组文件的示例(最后一个示例)。