本文介绍了如何解压缩特定文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用 Ant 解压缩特定文件夹?
How can I unzip a specific folder with Ant?
具体来说,我已经下载了包含文件夹apache-tomcat-6.0.29"的 apache-tomcat-6.0.29.zip.我希望 Ant 解压缩apache-tomcat-6.0.29"下的所有内容,但不包括层次结构顶部的apache-tomcat-6.0.29".
Specifically, I have downloaded apache-tomcat-6.0.29.zip which contains the folder "apache-tomcat-6.0.29". I want Ant to unzip everything under "apache-tomcat-6.0.29" but not include "apache-tomcat-6.0.29" in the top of hierarchy.
我尝试了很多方法,但似乎无法让它发挥作用.
I've tried a bunch of things, but I can't seem to get it to work.
这是我最近的尝试:
<unzip dest="${release.dir}/image/tomcat" src="${tomcat.zip}">
<patternset>
<include name="apache-tomcat-6.0.29/*"/>
</patternset>
</unzip>
有什么想法吗?
推荐答案
您可以使用 解压任务中的映射器以更改写入的路径.
You can use a mapper within the unzip task to change the paths written.
<unzip dest="${release.dir}/image/tomcat" src="${tomcat.zip}">
<patternset>
<include name="apache-tomcat-6.0.29/*"/>
</patternset>
<mapper>
<globmapper from="apache-tomcat-6.0.29/*" to="*"/>
</mapper>
</unzip>
这篇关于如何解压缩特定文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!