in reply to Reading a remote Filesystem

There's always File::RsyncP::FileList, File::Rsync, URI::rsync, and File::DirSync if you want to go that route.

You might also take a look at rcopy for some other ideas, which purports to mirror two servers together.

I did something similar, using a remote webserver's directory listing of files, and presenting them to my local machine as "local" files, for users to click/download/etc. Here's an example of that, using kernel.org in this case.

Basically what this does is fetch the remote "page" of files, extract the links, calculate the file sizes, "commify" them, and prints them out. Simple. Maybe this will give you a few ideas, depending on where/how these files are found.

use strict; use LWP::UserAgent; use HTML::LinkExtor; use URI::URL qw(url); my $url = "http://kernel.org/pub/linux/kernel/v1.0/"; my $ua = LWP::UserAgent->new; $ua->agent('pps 0.1.43'); my @links = (); sub callback { my ($tag, %attr) = @_; return if $tag eq 'href'; push(@links, values %attr); return (@links); } my $p = HTML::LinkExtor->new(\&callback); my $res = $ua->request( HTTP::Request->new(GET => $url), sub {$p->parse($_[0])}); my $base = $res->base; @links = map {$_ = url($_, $base)->abs;} @links; my @krn = grep(/tar/, @links); foreach my $krn (@krn) { my @remote_files = HTTP::Request->new(HEAD=>$krn); my $resp = $ua->request(@remote_files); my $length = $resp->header('Content-Length'); my $bprecise = sprintf "%.0f", $length; my $bsize = insert_commas($bprecise); my $kprecise = sprintf "%.0f", ($length/1024); my $ksize = insert_commas($kprecise); my $archtype; # tarball? or bzip2? or zip? my $krnhref = substr($krn, 48, 70); if ($krn =~ /tar.gz/) { $archtype = "tarball"; } elsif ($krn =~ /bz2/) { $archtype = "bzip"; } else { $archtype = "zip"; } print "Path: $krn\nFile: $krnhref "; print "($archtype) - ${ksize}kb, $bsize bytes\n\n"; } sub insert_commas { my $text = reverse $_[0]; $text =~ s/(\d{3})(?=\d)(?!\d*\.)/$1,/g; return scalar reverse $text; }