CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner: Re: [StarkRavingCalm] Compare unchanged files in two arrays: Edit Log


Jan 24, 2013, 1:00 PM

Views: 4693
Re: [StarkRavingCalm] Compare unchanged files in two arrays

I would still like to find a good solution for not displaying hidden files but I have another requirement currently.

After I download the files, I would like to do some local validation.
Basically compare the hash created in previous steps against a hash created from a local 'ls -la'.
I have it working but the sort order is all messed up:
This is from the remote server:

my %file;  

foreach my $entry ( $sftp->ls('/home/ftptest/inbound') )
my $size = (split(' ', $entry->{longname}))[4];
$file{$entry->{filename}} = $size;

print Dumper \%file;

$VAR1 = {
'file2' => '7',
'file1' => '4',
'file3' => '10',
'file4' => '13',
'..' => '4096',
'.' => '4096'

Here is the ls -la from the local directory:

my %local_files;
%local_files=`ls -ltr /tmp/scripttest/inbound | awk {'print \$9,\$5'}`;
print Dumper \%local_files;


VAR1 = {
'file3 10
' => 'file2 7
' => 'file4 13
'file1 4
' => undef

I know it's in the split statement on the one from the remote server, I just can't seem to get the combination correct.
Any clues?

(This post was edited by StarkRavingCalm on Jan 29, 2013, 11:10 AM)

Edit Log:
Post edited by StarkRavingCalm (User) on Jan 29, 2013, 11:10 AM

Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives