Search code examples
antunzip

Ant unzip task - how can I exclude the archive name from extracted hierarchy?


How can I exclude the archive name from the file hierarchy after an ant unzip task?

For example, once ant's run the unzip task in the folder C:\temp, I want all the files from the archive archive, but instead I get C:\temp\t\file.tmp.

Can I effectively exclude the base directory inside the archive?


Solution

  • Use a mapper specify how the files should look in the destination directory:

    <unzip src="t.zip" dest="temp">
        <globmapper from="t/*" to="*"/>
    </unzip>