Created
May 28, 2010 12:56
-
-
Save zeisss/417116 to your computer and use it in GitHub Desktop.
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/sh | |
URL=url_with_zips | |
LINKS=`curl $URL | grep -o "http:.*.zip"` | |
for link in $LINKS | |
do | |
FILENAME=`echo $link | grep -o "[A-Za-z0-9_]*.zip" | grep -o "[A-Za-z0-9_]*"` | |
TIME_LS=`ls --full-time $FILENAME.zip` | |
if [ -f $FILENAME.zip ]; then | |
echo Updating $FILENAME.zip from $link | |
# file exists, perform an update check | |
curl -Oz $FILENAME.zip $link | |
else | |
echo "New: $link" | |
curl -O $link | |
fi | |
NEW_TIME_LS=`ls --full-time $FILENAME.zip` | |
if [ "$TIME_LS" != "$NEW_TIME_LS" ]; then | |
echo "Unzipping updated archive for $FILENAME" | |
rm -rf $FILENAME # remove the old folder | |
unzip $FILENAME.zip | |
fi | |
done | |
./generate-index.sh |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment