Код:
#!/usr/bin/perl


use
  Getopt::Std;


my $baseurl = 'http://127.0.0.1';
my $pattern = "";
my $ext = ".jpg";
my $first = 1;
my $last = 20;
my $suffix="";
my $noq;
my $zerofill=0;
#my $wget_flags=" -U 'Mozilla/4.0 (compatible; MSIE 5.0;)' -S  -e '--robots=off' ";
my $wget_flags=" -U 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0) Opera 7.23  [en]' -S  -e '--robots=off' ";
my $wget;
my $referrer;
%opts=();
if( $#ARGV <0){
Usage();
};
#$noq=0;
getopt("ns:u:p:f:l:e:z:r:",\%opts);
$baseurl = $opts{u} if defined($opts{u});
$pattern = $opts{p} if defined($opts{p});
$ext = $opts{e} if defined($opts{e});
$first = $opts{f} if defined($opts{f});
$last = $opts{l} if defined($opts{l});
$suffix =$opts{s} if defined($opts{s});
$zerofill=$opts{z}+1 if defined($opts{z});
$referrer=$opts{r} if defined($opts{r});
$noq=1 if(  defined($opts{n}));
# $wget_flags.=$opts{w} if defined($opts{w});
if(not $baseurl =~ /\/$/)
{
$baseurl.="/";
}
if(defined($referrer))
{
$wget_flags.=" --referer=\"${referrer}\"";
}
else
{
$wget_flags.=" --referer=\"${baseurl}index.html\"";
}

$wget="wget $wget_flags";
print "Download using these options:\n baseurl=$baseurl; pattern=$pattern; \n ext=$ext; first=$first; last=$last; suffix=$suffix; \nzerofillfactor=$zerofill; wget_flags=$wget_flags\n";
if($noq )
{
print "noquestions = $noq\n";
print "Continue?";
$ch=getc;
if($ch !~ /y/i)
{
exit(0);
}
} #noquestions
my $i;
for ( $i = $last; $i >= $first; $i--)
  {
    my $file;
    my $format;
    $format=($zerofill>0)?"$pattern%0${zerofill}d$suffix$ext":"$pattern%d$suffix$ext";
    $file = sprintf ($format, $i);
    my $url = $baseurl.$file;

# $command = "$wget $url";
    if (-f $file)
      {
    $command = "$wget -c \'$url\'";
      }
    else
      {
    $command = "$wget  \'$url\'";
      }

    print "--------------\n";
    print " cmd  = $command \n";
    print "--------------\n";
    system $command;
    if ($ ? !=0)
      {
    print "Loading failed:(\n";
    if (-f $file)
      {
        $command = "$wget -c $url";
        print "--------------\n";
        print " cmd  = $command \n";
        print "--------------\n";
        system $command;

      }
    else
      {
        print "--------------\n";
        print " cmd  = $command \n";
        print "--------------\n";
        system $command;

        $command = "$wget  $url";
      }

      }

  };
  
sub Usage
{
print <<EOF;
pget.pl 0.1 Copyleft(L) by jcukeng (UInC team, [url=http://www.uinc.ru),2002]http://www.uinc.ru),2002[/url].
Usage: pget.pl -w wget_flags -u baseurl  -p pattern [-f first] [-l last] [-z zerofillfactor] [-s suffix] [-e fileextension]  
For example, if you run script as
pget -u "http://www.porno.com" -p NiceEmma -f 1 -l 15 -z 2 -s _in_bath -e ".jpg"
then the following files will be downloaded into current directory
[url=http://www.porno.com/NiceEmma001_in_bath.jpg]http://www.porno.com/NiceEmma001_in_bath.jpg[/url]
[url=http://www.porno.com/NiceEmma002_in_bath.jpg]http://www.porno.com/NiceEmma002_in_bath.jpg[/url]
...
[url=http://www.porno.com/NiceEmma010_in_bath.jpg]http://www.porno.com/NiceEmma010_in_bath.jpg[/url]
...
[url=http://www.porno.com/NiceEmma015_in_bath.jpg]http://www.porno.com/NiceEmma015_in_bath.jpg[/url]
Defaults:
wget_flags="-U 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 4.0; Q312461)' -S --referer=baseurl";
first=1
last=20
fileextension=".jpg"
suffix=""
zerofillfactor="", i.e. number will be not zero-filled; 1,2,3,...?, not 01,02,03 etc.
pattern=""
baseurl="http://127.0.0.1"
Of course, nobody claims that only porno jpeg's may by downloaded using this script :-).
You may pget .zip, .gzip, and .html as well.
Enjoy!
Yours, jcukeng :-)
EOF
exit(0);
}