Ant renaming while copying file

折月煮酒 提交于 2019-12-23 06:47:07

问题


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

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

回答1:


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>



回答2:


It should be as simple as

<copy file="mySourceFile" tofile="MyDestFile" />


来源:https://stackoverflow.com/questions/8971187/ant-renaming-while-copying-file

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!