给定一个带有未知目录的zip文件,如何重命名或将该目录移动到规范化路径?使用ant,在不知道完整路径的情况下重命名目录?
<!-- Going to fetch some stuff -->
<target name="get.remote">
<!-- Get the zipfile -->
<get src="http://myhost.com/package.zip"
dest="package.zip"/>
<!-- Unzip the file -->
<unzip src="package.zip"
dest="./"/>
<!-- Now there is a package-3d28djh3 directory. The part after package- is
a hash and cannot be known ahead of time -->
<!-- Remove the zipfile -->
<delete file="package.zip"/>
<!-- Now we need to rename "package-3d28djh3" to "package". My best attempt
is below, but it just moves package-3d28djh3 into package instead of
renaming the directory. -->
<!-- Make a new home for the contents. -->
<mkdir dir="package" />
<!-- Move the contents -->
<move todir="package/">
<fileset dir=".">
<include name="package-*/*"/>
</fileset>
</move>
</target>
我不是一个蚂蚁用户,任何洞察力都会有所帮助。
谢谢了,-Matt
捣乱工作的捣蛋。我有*不知道*逻辑流程应该在那里......我们用dirset创建一个路径,然后将它存储在正确的位置,以便我们可以在移动时访问它的字符串值。尼斯布莱恩'。 – mixonic 2010-04-06 19:34:14
Drat,当然这不适用于宏,因为它使用属性。 @#$ @(ant。 – mixonic 2010-04-07 12:53:13
我知道它已经2年了,而且这绝对有效,但我很想知道为什么这会起作用,为什么没有更直观的方法来简单地重命名“fixed-prefix- *”目录到“someConstantName” – radai 2012-09-08 15:01:10