Last active
April 1, 2020 18:42
-
-
Save steverobbins/11bac3bc5d3b6156e634d9aaf30978bd to your computer and use it in GitHub Desktop.
Quick and dirty script to save a whole site to archive.org
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 | |
URL=$1 | |
PATH=$2 | |
EXCLUDE=$3 | |
/bin/rm -rf "$URL" | |
echo "Gathering URLs..." | |
/usr/local/bin/wget -q -r -nc "$URL$PATH" -D "$URL" -X "$EXCLUDE" | |
echo "Sending to archive.org..." | |
/usr/bin/find "$URL" -type f -print0 | while IFS= read -r -d $'\0' LINE; do | |
echo "Saving $LINE" | |
/usr/bin/curl -s "https://web.archive.org/save/$LINE" > /dev/null & | |
/bin/sleep 1 | |
done | |
echo "Done" | |
/bin/rm -rf "$URL" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment