Created
October 23, 2011 18:48
-
-
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...)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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