• I am on a Windows machine using Cygwin
  • I want to connect to my raspberrypi and download a pdf from it called linuxnet.pdf
  • I am a user named Zak

Here is what I have been doing which has not been working all day.

I can connect successfully,

  • ssh pi@192.xxxx

The rest confuses me. This is what I am doing:

  • scp linuxnet.pdf zak@192.xxxx:linuxnet.pdf

It then tells me it has downloaded, but I have no idea where it is. I would like to transfer it to the windows machine I am working at to dir c:/users/docs

Please let me know if I need to clarify anything.

  • I have called it 'server' as in 'john' or 'mark' – python_starter Oct 28 '16 at 12:04
  • might be that destination should not include the filename itself. – Hermann Ingjaldsson Oct 28 '16 at 12:10
  • 1
    I'm not sure I understand. What machine are you running this from and what OS is it using? Are you on your local machine or on the server? Where, exactly, is the copy created and on what machine? Please edit your question and clarify. – terdon Oct 28 '16 at 12:30
  • 1
    Cygwin's default directory would be the users home dir e.g C:\cygwin\home\zak\ . If you downloaded it with out specifying a path, its most likely there. – Shane Andrie Oct 28 '16 at 20:59

This command

scp linuxnet.pdf zak@192.xxxx:linuxnet.pdf

Copies the local file linuxnet.pdf to the remote server 192.xxxx. It uses the user account zak and places the file in the remote user's home directory, named as linuxnet.pdf. Note that if 192.xxxx represents your Pi then it will have placed the file in Zak's home directory.

You said that you wanted to copy from the remote server to your local Windows client. In this case you should reverse the order of the arguments thus, and run the command from Cygwin:

scp zak@192.xxxx:linuxnet.pdf linuxnet.pdf

The lack of directory specification on the target filename means that it will be written to the current directory, whatever that is at the time you execute the copy.


[Edited] According to the extra information you added, you are first connecting to the raspberry pi, and then using the scp executable present on the raspberry pi. This will only work if you have set up a ssh serveur on the Windows machine, and I would expect it to be easier to copy the file directly from the Windows machine.

To download using scp on the Windows machine, launch Cygwin but do not use the ssh command. Rather, go to the directory you want to download in, using the following command : cd /cygdrive/c/path/that/you/like (obviously replacing c by the relevant drive letter and path/that/you/like by the relevant path, but still using / rather than \). Then use scp pi@192.xxxx:path/to/linuxnet.pdf . (replacing path/to/ by either the relative path from your home directory, or the absolute path). Alternatively, you can skip the first command and use scp pi@192.xxxx:path/to/linuxnet.pdf /cygdrive/c/path/that/you/like instead.

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.