Howdy Perl Monks,
I'm trying to use the Perl Module Net::MirrorDir to compare local and remote directories.
But in some cases I have file names with spaces between them and i can't get it compare the dir's.
Is it possible to do compare directories when there are file names with spaces between them?
Here is what i've got now:
sub compare_dirs {
my ($host, $login, $password, $dir, $rmt_dir) = @_;
my $md = Net::MirrorDir->new(
ftpserver => $host,
user => $login,
pass => $password,
localdir => $dir,
remotedir => $rmt_dir,
debug => 0, # 1 for yes, 0 for no
timeout => 60 # default 30
);
$md->Connect();
my ($ref_h_local_files, $ref_h_local_dirs) = $md->ReadLocalDir();
my ($ref_h_remote_files, $ref_h_remote_dirs) = $md->ReadRemoteDir(
+);
my $ref_a_local_files_not_in_remote = $md->LocalNotInRemote(
$ref_h_local_files,
$ref_h_remote_files
);
my $ref_a_remote_files_not_in_local = $md->RemoteNotInLocal(
$ref_h_local_files,
$ref_h_remote_files
);
#transfer remote files which are not on local system
foreach my $new_remote_file_not_in_local (@{$ref_a_remote_files_no
+t_in_local}) {
#transfer the files from remote site to local
print "$new_remote_file_not_in_local... \n";
}
#transfer local files not on remote system
foreach my $new_local_file_not_in_remote (@{$ref_a_local_files_not
+_in_remote}) {
#transfer files from local site to remote site
print "$new_local_file_not_in_remote... \n";
}
}
any help is appreciated.
Cheers