Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked

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 scrutinizing the Monastery: (4)
As of 2016-02-08 03:29 GMT
Find Nodes?
    Voting Booth?

    How many photographs, souvenirs, artworks, trophies or other decorative objects are displayed in your home?

    Results (266 votes), past polls