Thursday, 16 December 2004

See our volcano

And fetch them, too. Here's a script I wrote to fetch the pictures... You can run it every day and it fetch only the new ones.



#!/bin/bash

page=http://vulcan.wr.usgs.gov/Volcanoes/MSH/Images/MSH04/
ddir="/Pictures/Desktop Pictures/Volcano/"

for url in $(curl $page | sed -n 's/^\[large size\].*/\1/p')
do
fname=${ddir}$(basename $url)
if [ ! -f "$fname" ]
then
echo $fname
curl $url -o "$fname"
fi
done

page=ftp://ftpext.usgs.gov/pub/wr/wa/vancouver/MSH_Images/

for url in $(curl $page | awk '{f = substr($9,1,length($9)-1); printf "%s\n",f; }')
do
fname=${ddir}${url}
if [ ! -f "$fname" ]
then
url="$page$url"
echo $fname
curl $url -o "$fname"
fi
done



Well, I hope you get the idea. It seems to get messed up in the posting.

No comments:

Post a Comment