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

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

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



StarkRavingCalm
User

Feb 19, 2013, 1:33 PM


Views: 3098
Re: [FishMonger] Compare unchanged files in two arrays

Ok, seem to be closer... Thank You!!!


Code
my @hash_refs = @{ $sftp->ls('/home/ftptest/inbound') }; 

foreach my $entry ( @hash_refs )
{
next if $entry->{filename} =~ /^\./;
my $size = (split(' ', $entry->{longname}))[4];
$file{$entry->{filename}} = $size;
}

print Dumper \@hash_refs;

I think I need to mess with the fields it's picking up:

$VAR1 = [
{
'longname' => '-rw-rw-r-- 1 ftptest ftptest 171 Feb 18 11:23 newfile',
'a' => bless( {
'uid' => 541,
'flags' => 15,
'mtime' => 1361204601,
'atime' => 1361199077,
'perm' => 33204,
'gid' => 541,
'size' => 171
}, 'Net::SFTP::Foreign::Attributes' ),
'filename' => 'newfile'
},
{
'longname' => '-rw-rw-r-- 1 ftptest ftptest 171 Feb 18 11:23 newfile3',
'a' => bless( {
'uid' => 541,
'flags' => 15,
'mtime' => 1361204604,
'atime' => 1361204604,
'perm' => 33204,
'gid' => 541,
'size' => 171
}, 'Net::SFTP::Foreign::Attributes' ),
'filename' => 'newfile3'
},
{
'longname' => 'drwxrwxr-x 2 ftptest ftptest 4096 Feb 18 11:23 .',
'a' => bless( {
'uid' => 541,
'flags' => 15,
'mtime' => 1361204604,
'atime' => 1361309822,
'perm' => 16893,
'gid' => 541,
'size' => 4096
}, 'Net::SFTP::Foreign::Attributes' ),
'filename' => '.'
},
{
'longname' => 'drwx------ 4 ftptest ftptest 4096 Jan 22 15:46 ..',
'a' => bless( {
'uid' => 541,
'flags' => 15,
'mtime' => 1358887570,
'atime' => 1361199071,
'perm' => 16832,
'gid' => 541,
'size' => 4096
}, 'Net::SFTP::Foreign::Attributes' ),
'filename' => '..'
},
{
'longname' => '-rw-rw-r-- 1 ftptest ftptest 171 Feb 18 11:23 newfile2',
'a' => bless( {
'uid' => 541,
'flags' => 15,
'mtime' => 1361204603,
'atime' => 1361204603,
'perm' => 33204,
'gid' => 541,
'size' => 171
}, 'Net::SFTP::Foreign::Attributes' ),
'filename' => 'newfile2'
}
];


(This post was edited by StarkRavingCalm on Feb 19, 2013, 1:39 PM)


Edit Log:
Post edited by StarkRavingCalm (User) on Feb 19, 2013, 1:39 PM


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

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