Advertisement
metalx1000

Get all Projects for User on Github

Jul 2nd, 2015
729
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.69 KB | None | 0 0
  1. #!/bin/bash
  2. #for kris from kris :)
  3.  
  4. if [ $# -lt 1 ]
  5. then
  6.   echo "Useage: $0 <github username> <number of pages>"
  7.   exit
  8. fi
  9.  
  10. dir="githubBackup"
  11. user="$1"
  12. let pages="$2"
  13.  
  14. mkdir -p "$dir/$user"
  15. cd "$dir/$user"
  16.  
  17. clear
  18. echo "Backing up all github projects for $user..."
  19.  
  20. for p in `seq 1 $pages`;
  21. do
  22.   wget -q "https://github.com/metalx1000?page=$p&tab=repositories" -O- |\
  23.     grep codeRepository|\
  24.     cut -d\" -f2|\
  25.     while read url
  26.     do
  27.       #git clone "https://github.com${url}.git"
  28.       repo="$(echo "$url"|cut -d\/ -f3)"
  29.       wget "https://github.com${url}/archive/master.zip" -O "${repo}_master.zip"
  30.     done
  31. done
  32. clear
  33. echo "${user}'s projects backed up to $(pwd)."
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement