Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

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


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

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (11)
As of 2014-12-18 10:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (49 votes), past polls