Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Re: Download file from sftp or FTP

by gube (Parson)
on Dec 28, 2009 at 18:29 UTC ( #814644=note: print w/ replies, xml ) Need Help??

in reply to Download file from sftp or FTP

Thanks almet for ftp idea. Same, I got inputs from the node for SFTP. I got the files what i need from the directory using $sftp->ls.

my %args = (user => encode("iso-8859-1", $ftp_user) , password => enco +de("iso-8859-1", $ftp_passwd)); $args{ssh_args} = [ port => encode("iso-8859-1", $ftp_port) ] + if $ftp_port; $sftp = Net::SFTP->new($ftp_url, %args); return 0 if (!$sftp); $sftp->ls($ftp_additional_path, sub { my $ref = shift; if ($ref->{'filename'} = +~ /_3rdParty_/) { $files->{$ref->{'fil +ename'}} = 1 } }); print (keys %{$files}); $sftp->get(encode("iso-8859-1", $ftp_file), $local_file); my ($statuscode, $statustext) = $sftp->status; $log->error("\nFile not found") if($statustext ne "No error");

Comment on Re: Download file from sftp or FTP
Download Code

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://814644]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2015-12-01 10:57 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (798 votes), past polls