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

16

我该如何使用ANT重命名1..n个文件?我想将任何名称为xxxx.default.properties的文件重命名为xxxx.local.properties

谢谢。

2个回答

29

使用move任务,您可以像这样做:

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

试一试并让我们知道结果。


我们可以在 from 和 to 中使用正则表达式吗? - Anand
@unkwn 是的,你可以使用 regexmapper - Alfredo Cavalcanti

2
使用move-task。最后的示例中还有如何重命名一组文件的示例。

谢谢!我正在使用move-task。请参考OscarRyz的回答。 - Thomas

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接