Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

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");

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 about the Monastery: (9)
As of 2016-09-30 18:49 GMT
Find Nodes?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:

    Results (571 votes). Check out past polls.