
StarkRavingCalm
User
Jan 24, 2013, 1:00 PM
Post #16 of 47
(23824 views)
|
Re: [StarkRavingCalm] Compare unchanged files in two arrays
[In reply to]
|
Can't Post
|
|
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; RESULTS: $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;RESULTS: 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)
|