title: Perl: Downloading all .jpgs from a web directory
body: <pre><code>#!/usr/bin/perl
  
  use strict;
  use warnings;
  use WWW::Mechanize;
  use FindBin qw($Bin);
  print $Bin;
  my $folder = "$Bin/Resources";
  mkdir($folder, 0700) unless(-d $folder );
  chdir($folder) or die "can't chdir $folder\n";
  my $url = 'http://www.ukgamingcomputers.co.uk/images/zalmanz11plus.jpg';
  my $local_file_name = 'pic.jpg';
  my $mech = WWW::Mechanize-&gt;new;
  $mech-&gt;get( $url, ":content_file" =&gt; $local_file_name );
  </code></pre>
  
  <p>I am currently using this code to download a .jpg and put it in a folder called Resources. I want to download all the .jpgs in the <a href="http://www.ukgamingcomputers.co.uk/images/" rel="nofollow">http://www.ukgamingcomputers.co.uk/images/</a> directory. I have absolutely no idea how I would achieve this. If you have a code solution, I would be grateful!</p>