开发者

Renaming files with dir values using Ant?

开发者 https://www.devze.com 2023-04-01 07:27 出处:网络
I have the following simple thing to do with Ant but did not fi开发者_JS百科nd how to do that: move build/xxx/file.ext to dest/xxxfile.ext

I have the following simple thing to do with Ant but did not fi开发者_JS百科nd how to do that:

move build/xxx/file.ext to dest/xxxfile.ext

I'm no Ant Guru . file.ext is constant in this particular case

Nota : xxx can take many values so I want to apply to all these values


You need to use a mapper element to generate the destination file names. This is derived from the Ant mapper docs:

<move todir="dest">
    <fileset dir="build" includes="*/*.ext" />
    <mapper type="regexp" from="^([^/]*)/([^/]*)" to="\1\2"/>
</move>


When in doubt, an exec will do the job for you, but it's not always the best way.

Try the move task.

<move file="build/xxx/file.ext" tofile="dest/xxxfile.ext"/>
0

精彩评论

暂无评论...
验证码 换一张
取 消