我怎么压扁蚂蚁的zip文件的顶层文件夹? [英] How do I flatten the top level folder of a zip file with ant?
本文介绍了我怎么压扁蚂蚁的zip文件的顶层文件夹?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有一个很大的zip文件有一个根文件夹,我怎么解压缩zip文件,摆脱根文件夹?
A lot of zip files have a root folder, how do I unpack the zip file and get rid of the root folder?
我知道还有就是 globmapper
:
<unzip dest="${dest.path}">
<fileset dir="${source.path}">
<include name="**/zipfile*.*.zip" />
</fileset>
<mapper>
<globmapper from="rootFolder/*" to="*" />
</mapper>
</unzip>
但是,如果我不知道哪根文件夹的名称?通配符不工作例如。
But what if I don't know the name of the root folder? Wildcards are not working e.g.
<globmapper from="root*Folder/*" to="*" />
有没有使用通配符或映射器/功能,如果没有根文件夹upacks的方式?
Is there a way to use wildcards or a mapper/function that upacks without the root folder?
推荐答案
有实际上是专门为这款名为cutdirsmapper做一个单独的映射。试试这个:
There's actually a separate mapper specifically made for this called cutdirsmapper. Give this a try:
<unzip dest="${dest.path}">
<fileset dir="${source.path}">
<include name="**/zipfile*.*.zip" />
</fileset>
<cutdirsmapper dirs="1" />
</unzip>
这篇关于我怎么压扁蚂蚁的zip文件的顶层文件夹?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文