Skip to content

Instantly share code, notes, and snippets.

Created October 23, 2011 18:48
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/1307703 to your computer and use it in GitHub Desktop.
Save anonymous/1307703 to your computer and use it in GitHub Desktop.
Download big git repositories over HTTP (using curl now, might want to replace with corresponding wget...)
#!/bin/bash
link=$1
to=$2
echo "Link $link"
echo "To $2"
function createdirs {
echo "createdirs Arg $1"
for dir in $(curl $link$1 | grep "href=" | sed 's/^.*href="//' | sed 's/">.*$//' | grep -v '/git' | grep -v '^\?' | grep '/$')
do mkdir -p $to$1$dir
echo "To arg dir $to$1$dir"
createdirs $1$dir
echo "recursing $1$dir"
done
getfiles $1
}
function getfiles {
echo "getfiles Arg $1"
for file in $(curl $link$1 | grep "href=" | sed 's/^.*href="//' | sed 's/">.*$//' | grep -v '/git' | grep -v '^\?' | grep -v '/$')
do curl $link$1$file -o $to$1$file
echo "Link arg file $link$1$file to arg file $to$1$file"
done
}
createdirs /
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment