in reply to Net::SCP can't connect to Windows server

You forgot to load Net::SCP::Expect.
#!/usr/bin/perl use strict; use warnings; use Net::SCP::Expect; my $file = '/path/to/xyz.txt'; my $destdir = '/tmp'; my $host = '127.0.0.1'; my $user = 'user'; my $scpe = Net::SCP::Expect->new( host => $host, user => $user, password => 'password', auto_yes => 1, verbose => 1, debug => 1, timeout_auto => 2, ); die "can't scp: $!\n" unless $scpe->scp($file, $destdir);

Replies are listed 'Best First'.
Re^2: Net::SCP can't connect to Windows server
by ikegami (Patriarch) on Nov 01, 2011 at 05:40 UTC
    No, forgetting to load Net::SCP::Expect would result is a very different error. Of course, that means the OP didn't post the code he actually ran, which is greatly going to limit the help we can give and the effort we will give.
      Thank you all for your responses. The problem has been solved. I have to specify the directory on the windows side as:
      my $destdir = '/C/Data/';
      instead of
      my $destdir = "C:\\Data\\";
      Thank you very much for your reply. My actual command line is:
      scp /tmp/data.txt user@123.456.789.24:"C:\\Data\\"
      after password prompt, it worked fine. My first question is: how do I specify windows destination directory? I used:
      my $destdir = '"C:\\Data\\"';
      I got the error: scp timed out while trying to connect to "C at ./net_scp.pl line 33 What is the correct directory specification on the windows side? Thanks much.