Skip to content

Instantly share code, notes, and snippets.

@sferich888
Created April 24, 2014 20:16
Show Gist options
  • Save sferich888/11268083 to your computer and use it in GitHub Desktop.
Save sferich888/11268083 to your computer and use it in GitHub Desktop.
bash script to save a directory of repositories with 1 or two sub-directories in side them that are SVN repositories.
DEBUG=TRUE
SAVE_FILE=/tmp/REPOS
REPO_DIR="$HOME/Repositories/" && cd $REPO_DIR
echo "Moved into Repository Directory: $(pwd)"
for repo in $(ls); do
echo "Saving: $repo"
cd $repo; git remote -v | grep -e push | awk '{print $2}' >> $SAVE_FILE
for cdir in $(ls -d */ | grep -v "\."); do
if [[ $DEBUG == "TRUE" ]]; then echo "Checking for SVN repos at $cdir"; fi
if [[ -e $cdir/.svn ]]; then
cd $cdir/
echo -n "SVN:" >> $SAVE_FILE
svn info | grep 'URL: [sh]' | cut -d ':' -f 2,3 >> $SAVE_FILE
fi
done
echo >> $SAVE_FILE
cd $REPO_DIR
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment