$dir = "http://myserver.com/images"; opendir(DIR, $dir) or die $!; while (my $file = readdir(DIR)) { # only files next unless (-f "$dir/$file"); # find files ending in .JPG next unless ($file =~ m/\.JPG$/); print "$file\n"; # Here I need to send all found pictures to a location in my local directory. } closedir(DIR); exit 0;