2

I am trying to overwrite some directories with content in them on a remote location using pscp to a remote location. I use root user (root@locationServerName). It succeeds in most of them, but fails in some of them returning $? = 1.

The output of the command looks like that:

Sending file filename1.txt, size=2990
filename1.txt             |          2 kB |   2.9 kB/s | ETA: 00:00:00 | 100%
Sending file filename2.txt, size=2665135
filename2.txt: unable to open /path/to/file/location/filename2.txt: failure
Sending file filename3.txt, size=2990
filename3.txt             |          2 kB |   2.9 kB/s | ETA: 00:00:00 | 100%

It looks like for some reason it can't overwrite the files, but I can't figure why or how could I fix it. Running it in verbose mode, doesn't say anything helpful. If I delete the files manually on the target location, then the operation succeeds.

Any ideas?

5

I have been told this is the solution to that problem, at least to the same unable to open...failure error.

You have to quote the unix-style path:

pscp.exe -r C:\data user@server:"/home/user/path/"
| improve this answer | |
  • 2
    I thought this might only be necessary if there are spaces in the unix path, but I needed the double quotation marks even with no spaces. (I am not sure if this is an answer to OP's question, but google brought me here for the "unable to open .. failure" error, and it solved my problem.) – craq Sep 18 '18 at 22:46
  • This solved my problem exactly. I do not understand why though. If anyone has that answer, we would all love to know! – SovietFrontier Jan 24 at 16:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.