A lot of zip files have a root folder, how do I unpack the zip file and get rid of the root folder?
I know there is the 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="*" />
Is there a way to use wildcards or a mapper/function that upacks without the root folder?
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With