Ant renaming while copying file

2019-06-15 01:23发布

How to rename file while copying it to directory in ant?

<copy file="..." todir="..." overwrite="true">

标签: ant
2条回答
在下西门庆
2楼-- · 2019-06-15 01:52

It should be as simple as

<copy file="mySourceFile" tofile="MyDestFile" />
查看更多
做自己的国王
3楼-- · 2019-06-15 02:05

Use tofile option instead of todir


Added

Or a more complex example from Ant Copy Task documentation:

Copy a set of files to a directory, appending .bak to the file name on the fly

  <copy todir="../backup/dir">
    <fileset dir="src_dir"/>
    <globmapper from="*" to="*.bak"/>
 </copy>
查看更多
登录 后发表回答