Skip to content

Instantly share code, notes, and snippets.

@karbassi
Created June 25, 2012 16:57
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save karbassi/2989864 to your computer and use it in GitHub Desktop.
Save karbassi/2989864 to your computer and use it in GitHub Desktop.
Create a ZIP file from an SVN url

Installing

  • Download svn-zip into /usr/local/bin/. For example: curl https://raw.github.com/gist/2989864/svn-zip > /usr/local/bin/svn-zip
  • Make sure that /usr/local/bin/ is in your PATH.

Usage

In your terminal, use:

svn-zip SVN_URL ZIP_FILE_NAME

The ZIP_FILE_NAME does not need a .zip ending.

#!/bin/bash
if [ $# -ne 2 ] ; then
echo "Usage: "`basename "$0"` "SVN_URL ZIP_NAME" >&2
exit 1
fi
SVN_URL=$1
DIR_NAME=$2
cd ~/Desktop/ && svn export $SVN_URL $DIR_NAME && zip -rq ${DIR_NAME}.zip $DIR_NAME && rm -rf $DIR_NAME
cd -
echo "Successfully created ${DIR_NAME}.zip from ${SVN_URL}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment