# A program to download a lot of images from a site # quickly using LWP::Simple. Assuming you have appropriate # permission, etc to download the images, and that the # images have sequential names (like img_001.jpg, # img_002.jpg...), this program will load those images # into the current folder. You have to have the # LWP::Simple module for this to work. -tim allen use LWP::Simple; use strict; # first part of the URL of the image # replace the URL and path info here appropriately my($pix)='http://tim/images/img_'; for (my $i=1;$i<100;$i++) { # this bit assumes the numbers of the files are zero # padded to three zeroes (thanks btrott for sprintf # pointer) my $f = sprintf '%03d',$i; # create the full URL of the image # (like http://www.somesite.com/images/img_001.jpg) my $url = $pix . $f . ".jpg"; # If we get the header, the image file exists if (!head($url)) { warn "sorry, $url doesn't exist\n"; } else { # it exists, so get it and store it getstore($url,"img_$f.jpg") or warn "can't get image: $!"; # Print a progress message print "$url successfully stored\n"; } } print "Done!\n";