7

With pscp in windows command line, I can send file from Windows to Pi or I can copy a file from Pi to Windows. But opposite does not work. I cant send a file from pi to windows with pi's terminal.

scp text.txt [email protected]:C:/Users/Desktop/

or "C/Users/Desktop" with out colon.

Both does not work. It returns nothing. After few minutes it says connection timed out.

4
  • 1
    first thing I notice is that is not the path to the desktop in windows it is c:/users/username/Desktop. You also need to have an SSH server running on the windows side. Dec 24, 2015 at 18:30
  • yes i noticed that windows does not support ssh natively. So i will try os.execute in Lua script with pscp. Thank you
    – Reactionic
    Dec 24, 2015 at 18:34
  • I think Cygwin has a sshd daemon that might be of use for this. I was aware that my old PC had some cygwin deamons running and I thought one of them was a sshd one though now I am not so sure - I found this article which seems quite informative at least as up to Windows 7 but I won't post it as an answer as I do not know if it is still accurate for later versions.
    – SlySven
    Dec 24, 2015 at 19:35
  • @Israr Ali - Hi there and welcome to SE. I notice that around various Stack Exchange sites that you have been suggesting edits that add simply "Waiting for your response. Thanks." Please don't do that. You should edit questions that have serious formatting issues, or a series of typos, mistakes, etc. Not to simply add thanks, as it adds nothing to the question, whatsoever... In fact, "Hi", "Thanks", Regards" and signatures are usually edited out of questions, in order to keep the post short. Thank you for your understanding. Apr 22, 2019 at 11:06

6 Answers 6

7

When you run scp/pscp/ssh/... on windows, you are connecting to the ssh server running on the pi.

To do the opposite, to run these commands on the pi to connect to windows, an ssh server must be running on the windows machine.

It seems that's what you're missing. You need to install an ssh server on the windows machine. This might not be trivial, but certainly doable.

1
  • thak you i solved problem with calling files from winodws
    – Reactionic
    Dec 29, 2015 at 15:00
3

For a smooth and powerful two way SSH conversation with your PI (or any other Linux box), use WinSCP
The interface is very intuitive; will even read your saved PuTTY hosts as default host destinations.
Both are the best weapons on your toolbox.

1
  • thak you i solved problem with calling files from winodws
    – Reactionic
    Dec 29, 2015 at 15:00
1

You might use from Windows cmd: scp pi@'rpi's ip address':text.txt text.txt

In this case you don't need an SSH server on Windows, because you use the Raspberry Pi's SSH server and actually send a receive command.

Example on my computer: Windows cmd: scp [email protected]:rpi_testfile.txt rpi_testfile.txt Then I have rpi_testfile.txt on my computer.

2
  • This doesn't answer the question.
    – RalfFriedl
    Apr 21, 2019 at 15:30
  • It does.I put an example how to send data from rpi to Windows PC.
    – David Imre
    Apr 23, 2019 at 8:55
0

An easier way to send files from pi to a laptop/computer is to:

  1. open a terminal in your computer and check if ssh connection is available using ssh user@your IP address
  2. if ssh is good and running: In your personal computer terminal type scp user@your_ip:folder/filename /path in your personal computer.

Good luck

1
  • As it’s currently written, your answer is unclear and it looks like you haven't read the question. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – MatsK
    Oct 21, 2021 at 9:36
0

SCP works for both sending and receiving from the PI, it depends on the order in which you put the device and the file in the command. The way you have it written, your order is for sending to the PI:

scp text.txt [email protected]:C:/Users/Desktop/

instead, to receive from pi it should read:

scp [email protected]:text.txt C:/Users/Desktop/

Additionally, the path at the end can be changed to '.' to specify current directory.

scp [email protected]:text.txt .
0
  1. Turn on Raspberry Pi (I'm using RPi Zero 2 W)
  2. Open Windows Powershell on PC/Laptop
  3. Type in this (in directory that you use) :- scp [email protected]:programs/sleep.py . C:/users/peter/Downloads

where :-

scp - is the command [email protected] - is the RPi's IP address

:programs/sleep.py - the folder AND file that you want to copy (NB note ':')

' . ' - denotes current location (i.e. folder stated above)

C:/users/peter/Downloads - location on PC where you want file to go

  1. The PC will respond with - [email protected]'s password:
  2. Type in your password to the RPi.
  3. The PC will respond -

sleep.py 100% 348 21.0KB/s 00:00 0 File(s) copied

  1. The PC will return to input prompt >

NB - it states 0 File(s) copied, but if you look in the receiving location, you will find that the file has been copied ! (weird)

Happy scping 😊

Peter

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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