Search code examples
buildautomationzipreleasenant

How to unzip a file using nant script? Nant unzip task showing some error?


I need to unzip some files using nant script. For that I created a build file.

But it throwing some error like this

Invalid zip file... , Wrong local signature 0X..

my unzip code is like this

<unzip zipfile="${filename}"/>

How can I fix this issue. Any other method is available to do this extration. Please help me.

Thanks


Solution

  • Run 7z with the exec task.

    <exec program="c:\pathto7zip\7z.exe">
       <arg line="e -oc:\temp\extracted_textfiles textfiles.zip"/>
    </exec>
    

    This extracts the files from textfiles.zip into a folder c:\temp\extracted_textfiles.