Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things

(OT) Copying files from Window to Linux box

by perlynewby (Scribe)
on Jan 11, 2022 at 22:44 UTC ( #11140391=perlquestion: print w/replies, xml ) Need Help??

perlynewby has asked for the wisdom of the Perl Monks concerning the following question:

I have not been successful in getting to copy the window files to a Linux directory. I keep getting stomped during this procedure which I need to write into my Perl script to edit individual files in place

 scp "\\rls02\common\TECH_DEV\PUBLIC\Orders\CUSTOMER ORDERS\GE4567_TX-03A\A1\MOR_GE4567_6579_A1.docx""
password: \\rls02\common\TECH_DEV\PUBLIC\Orders\CUSTOMER ORDERS\GE4567_TX-03A\A1 +\MOR_GE4567_6579_A1.docx: No such file or directory

I think there is no ssh mounted and cannot do this function

Is there another method to copying the files that reside on Windows side to linux ?

Replies are listed 'Best First'.
Re: (OT) Copying files from Window to Linux box
by stevieb (Canon) on Jan 11, 2022 at 23:17 UTC

    You are getting a password prompt. That means that scp is installed locally and the Linux system is responding.

    The error here is that your Windows system says that the file you're trying to copy is not found.

    It could also be a permissions issue. Check that the user you're using scp with can actually open the document.


    steve@maezi ~/scratch/scp_test >ll total 0 drwxr-xr-x 2 steve staff 64 11 Jan 15:20 . drwxr-xr-x 14 steve staff 448 11 Jan 15:20 .. steve@maezi ~/scratch/scp_test >scp blah.txt cesium:/home/steve blah.txt: No such file or directory steve@maezi ~/scratch/scp_test >touch blah.txt steve@maezi ~/scratch/scp_test >ll total 0 drwxr-xr-x 3 steve staff 96 11 Jan 15:22 . drwxr-xr-x 14 steve staff 448 11 Jan 15:20 .. -rw-r--r-- 1 steve staff 0 11 Jan 15:22 blah.txt steve@maezi ~/scratch/scp_test >scp blah.txt cesium:/home/steve blah.txt 100% 0 0. +0KB/s 00:00
Re: (OT) Copying files from Window to Linux box
by salva (Canon) on Jan 12, 2022 at 12:50 UTC
    The problem you are facing is that most programs ported from UNIX (in your case, scp) are not able to handle Windows share paths correctly.

    Net::SSH::Any seems to handle them right:

    $ssh = Net::SSH::Any->new("", user=>luccap, password=>$password) +; $ssh->scp_put('\\\\rls02\\common\\TECH_DEV\\PUBLIC\\Orders\\CUSTOMER O +RDERS\\GE4567_TX-03A\\A1\\MOR_GE4567_6579_A1.docx', '/home/luccap/MOR_GE4567_6579_A1.docx') or die $ssh->error;
Re: (OT) Copying files from Window to Linux box
by talexb (Chancellor) on Jan 12, 2022 at 02:43 UTC

    Here's a simplification you can make -- navigate to the source directory (\\rls02\common\TECH_DEV\PUBLIC\Orders\CUSTOMER ORDERS\GE4567_TX-03A\A1) before you start the copy; then check the file you want to move really is present where you are; and finally, use scp to copy from local to remote location.

    Good luck!

    Alex / talexb / Toronto

    Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

Re: (OT) Copying files from Window to Linux box (OT / scp)
by LanX (Saint) on Jan 11, 2022 at 22:57 UTC
    Not a Perl question.

    You are aware that scp is not out of the box available on win?

    There are various methods to activate/install it depending on your OS version.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11140391]
Approved by salva
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (1)
As of 2023-10-05 03:17 GMT
Find Nodes?
    Voting Booth?

    No recent polls found