Skip to content

Instantly share code, notes, and snippets.

@zeisss
Created May 28, 2010 12:56
Show Gist options
  • Save zeisss/417116 to your computer and use it in GitHub Desktop.
Save zeisss/417116 to your computer and use it in GitHub Desktop.
#!/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