Skip to content

Instantly share code, notes, and snippets.

@waldbach
Forked from karbassi/Instructions.md
Created July 12, 2023 16:02
Show Gist options
  • Select an option

  • Save waldbach/e67ae1293351131a9f2885d1d2370ab7 to your computer and use it in GitHub Desktop.

Select an option

Save waldbach/e67ae1293351131a9f2885d1d2370ab7 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