Hi Monks,

I have been trying to use C:/Windows/System32/OpenSSH/scp.exe command to copy a file from windows10 to unix server. But I always get error,

system cannot find the path specified.

I have generated rsa key and copied into authorised_keys file at unix server. So no password required.

my $src_cmd = "C:/Windows/System32/OpenSSH/scp ". $src_file. " vinot +hg\@$server:".$target_path; print("Source copy cmd: $src_cmd\n"); my $output = qx($src_cmd); my $status = $? >> 8 ; if( $status ){ print("Error: $output\n"); return 0 }

It prints,

Source copy cmd: C:/Windows/System32/OpenSSH/scp D:/dev/eee/src/sample +.dat vinothg@ipaddress:/home/vinothg/src/20200218124538501.dat The system cannot find the path specified.

even I tried with sing backward slash(\) and double(\\)slash, but getting the same error. But when I copy and run the above command in windows cmd prompt it copies the files correctly without any issues.

I have been asked to use this scp command instead of installing perl modules.


All is well. I learn by answering your questions...

In reply to scp file from windows10 to unix server by vinoth.ree

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.