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

Re: Download file from sftp or FTP

by gube (Parson)
on Dec 28, 2009 at 18:29 UTC ( [id://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 http://www.perlmonks.org/?node_id=539261 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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-04-20 00:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found