http://qs321.pair.com?node_id=11113093

vinoth.ree has asked for the wisdom of the Perl Monks concerning the following question:

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...