Skip to content

Instantly share code, notes, and snippets.

@tamirko
Created August 2, 2012 14:07
Show Gist options
  • Save tamirko/3237336 to your computer and use it in GitHub Desktop.
Save tamirko/3237336 to your computer and use it in GitHub Desktop.
unzip with ant in groovy
/* Groovy Usage:
This code snippet unzips /tmp/stuff/myFile.zip to the /opt/apps folder.
Any file/folder inside myFile.zip which already exists in /opt/apps folder,
will NOT be overriden.
*/
builder = new AntBuilder()
builder.unzip(src:"/tmp/stuff/myFile.zip", dest:"/opt/apps", overwrite:false)
/* Usage in Cloudify:
The following code snippet unzips(untars) the /home/user/data/myfile.tgz file
to the /home/user folder.
Any file/folder inside myTarfile.tgz that already exists in the destination folder,
will be overridden.
In this case, the compression method that was used to create
this zipped file is "gzip'.
*/
installDir = "/home/user"
builder = new AntBuilder()
builder.untar(src:"${installDir}/data/myTarfile.tgz", dest:"${installDir}", compression:"gzip", overwrite:true)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment