thats correct the windows machine is running an ssh server, I had setup a widows test environment and ran your code on the linux end of this setup - and no issuesrunning your code on linux shows no issues. made some minor changes and to your code (listed below), and placed a copy of the file, that caused the issue initially, on the windows host to demonstrate the failure.
## scp.pl ## use strict; use warnings; use Net::SSH2; die "Usage: perl scp.pl host username password" unless @ARGV == 3; my $host = $ARGV[0]; my $user = $ARGV[1]; my $password = $ARGV[2]; my $ssh2 = Net::SSH2->new(); $ssh2->debug(1); print "\nconnecting to $host...\n"; $ssh2->connect($host) or die $ssh2->error; print "\nauth to $host...\n"; $ssh2->auth_password($user,$password) or die $ssh2->error; printf "Auth OK: %s\n", $ssh2->auth_ok; print "scp put\n"; my $ret = $ssh2->scp_put("rub'bish.txt", "rub'bish.txt"); print "ret: $ret\n"; $ssh2->disconnect(); ### print("...\n\n"); $ssh2=undef; $ssh2=Net::SSH2->new(); $ssh2->debug(1); $ssh2->connect($host) or die $ssh2->error; $ssh2->auth_password($user,$password) or die $ssh2->error; $ssh2->scp_get("rub'bish.txt", "more-rub'bish.txt"); printf("SSH Error (%s): '%s' - '%s'\n",$ssh2->error); $ssh2->disconnect(); print("...\n\n"); $ssh2=undef; $ssh2=Net::SSH2->new(); $ssh2->debug(1); $ssh2->connect($host) or die $ssh2->error; $ssh2->auth_password($user,$password) or die $ssh2->error; $ret=$ssh2->scp_get("06 School's Out.mp3", "06 School's Out.mp3"); printf("SSH Error (%s): '%s' - '%s'\n",$ssh2->error); $ssh2->disconnect();
and the terminal out is
wet@slack-one:~$ echo '3 blind mice, girls in a tub' > "rub'bish.txt" wet@slack-one:~$ perl scp-t.pl snoopy wet wetwipe connecting to snoopy... auth to snoopy... Auth OK: 1 scp put libssh2_scp_send_ex(ss->session, path, mode, size, mtime, atime) -> 0x +87123a0 Net::SSH2::Channel::read(size = 1, ext = 0) - read 1 bytes - read 1 total Net::SSH2::Channel::DESTROY ret: 1 ... Net::SSH2::DESTROY object 0x870a3e8 Net::SSH2: created new object 0x870a3e8 libssh2_scp_recv(ss->session, path, &st) -> 0x87123a0 Net::SSH2::Channel::read(size = 29, ext = 0) - read 29 bytes - read 29 total Net::SSH2::Channel::read(size = 1, ext = 0) - read 1 bytes - read 1 total Net::SSH2::Channel::DESTROY SSH Error (0): '' - '' ... Net::SSH2::DESTROY object 0x870a3e8 Net::SSH2: created new object 0x870a3e8 libssh2_scp_recv(ss->session, path, &st) -> 0x0 SSH Error (-28): 'LIBSSH2_ERROR_SCP_PROTOCOL' - 'Failed to recv file' Net::SSH2::DESTROY object 0x870a3e8 wet@slack-one:~$ wet@slack-one:~$ ls -la total 24 drwx--x--x 2 wet users 4096 Aug 12 14:38 ./ drwxr-xr-x 7 root root 4096 Aug 12 13:46 ../ -rw-r--r-- 1 wet users 3729 Jul 18 2011 .screenrc -rw-r--r-- 1 wet users 29 Aug 12 14:37 more-rub'bish.txt -rw-r--r-- 1 wet users 29 Aug 12 14:37 rub'bish.txt -rw-r--r-- 1 wet users 1260 Aug 12 14:37 scp-t.pl wet@slack-one:~$
then checking out the windows directory listing, shock-horror-wtf, brings to light the obvious, there is some extra quoting going on somewhere. The original windows machine in question is a hub of sorts serving a number of clients (windows) who dont have this issue.
C:\netupfiles\home\wet>dir Volume in drive C is Polly Volume Serial Number is D00B-FC85 Directory of C:\netupfiles\home\wet 2013/08/12 04:36 PM <DIR> . 2013/08/12 04:36 PM <DIR> .. 2013/08/12 04:10 PM 29 'rub'''bish.txt' 2006/12/20 12:46 AM 8 427 472 06 School's Out.mp3 2 File(s) 8 427 501 bytes 2 Dir(s) 160 523 104 256 bytes free C:\netupfiles\home\wet>
thank you to syph... your response prompted me to some usefull action, making the problem a little clearer...

In reply to Re^2: >Windows filename troubles with Net::SSH2 by wet
in thread >Windows filename troubles with Net::SSH2 by wet

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.