FreeKB - Getting Started with Net::SFTP
Perl - Getting Started with Net::SFTP

This assumes you have installed the Net::SFTP module on your Perl system. Following is the most simple example of how to GET or PUT using the SFTP module.

#!/usr/bin/perl

use strict;
use warnings;
use Net::SFTP;

my $host        = "your_hostname";
my %args        = ();
$args{username} = "your_username";
$args{password} = "your_password";
$args{debug}    = "true";

my $sftp = Net::SFTP->new($host, %args);

$sftp->get("/path/to/local/foo.txt", "/path/to/remote/foo.txt");
$sftp->put("/path/to/local/foo.txt", "/path/to/remote/foo.txt");

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter ad4de in the box below so that we can be sure you are a human.




Comments