Net::MirrorDir is a Perl extension for compare local-directories and remote-directories with each other.
SYNOPSIS
use Net::MirrorDir;
my $md = Net::MirrorDir->new(
ftpserver => "my_ftp.hostname.com",
usr => "my_ftp_usr_name",
pass => "my_ftp_password",
);
or more detailed
my $md = Net::MirrorDir->new(
ftpserver => "my_ftp.hostname.com",
usr => "my_ftp_usr_name",
pass => "my_ftp_password",
localdir => "home/nameA/homepageA",
remotedir => "public",
debug => 1 # 1 for yes, 0 for no
timeout => 60 # default 30
delete => "enable" # default "disabled"
connection => $ftp_object, # default undef
exclusions => ["private.txt", "Thumbs.db", ".sys", ".log"],
);
$md->SetLocalDir("home/name/homepage");
print("hostname : ", $md->get_ftpserver(), "n");
$md->Connect();
my ($ref_h_local_files, $ref_h_local_dirs) = $md->ReadLocalDir();
if($md->{_debug})
{
print("local files : $_n") for(sort keys %{$ref_h_local_files});
print("local dirs : $_n") for(sort keys %{$ref_h_local_dirs});
}
my ($ref_h_remote_files, $ref_h_remote_dirs) = $md->ReadRemoteDir();
if($md->{_debug})
{
print("remote files : $_n") for(sort keys %{$ref_h_remote_files});
print("remote dirs : $_n") for(sort keys %{$ref_h_remote_dirs});
}
my $ref_a_new_local_files = $md->LocalNotInRemote($ref_h_local_files, $ref_h_remote_files);
if($md->{_debug})
{
print("new local files : $_n") for(@{$ref_a_new_local_files});
}
my $ref_a_new_local_dirs = $md->LocalNotInRemote($ref_h_local_dirs, $ref_h_remote_dirs);
if($md->{_debug})
{
print("new local dirs : $_n") for(@{$ref_a_new_local_dirs});
}
my $ref_a_new_remote_files = $md->RemoteNotInLocal($ref_h_local_files, $ref_h_remote_files);
if($md->{_debug})
{
print("new remote files : $_n") for(@{$ref_a_new_remote_files});
}
my $ref_a_new_remote_dirs = $md->RemoteNotInLocal($ref_h_local_dirs, $ref_h_remote_dirs);
if($md->{_debug})
{
print("new remote dirs : $_n") for(@{$ref_a_new_remote_dirs});
}
$md->Quit();
This module is written as base class for Net::UploadMirror and Net::DownloadMirror. Howevr, it can be used, also for something other. It can compare local-directories and remote-directories with each other. In order to find which files where in which directory available.
Product's homepage
Requirements:
· Perl