Transfer A File From Another Computer To A Pi

There are several ways to do this:

  • Secure copy scp
  • File Transfer Protocol (FTP)
  • Secure File Transfer Protocol (SFTP)
  • Via an SMB connection

Transfer a File from Linux/Mac to a Raspberry Pi

Open up a Terminal window and type in the following command:

scp /destination/filename pi@raspberrypi.local:destination/path

Alternatively, you can use your Pi’s IP address to navigate to the Pi/Linux box, so for instance would type in:

scp /destination/filename pi@19X.XXX.XXX.XXX:destination/path (substituting raspberrypi.local for your device’s IP address)

For example, say I want to transfer a document that is in the Documents folder on my Mac, called filetransfertest, into a folder on my Raspberry Pi’s desktop that is called alifolder. Here is what I would type:

scp ~/Documents/filetransfertest.rtf pi@raspberrypi.local:~Destkop/alifolder (one line)

Enter when done with the command line. You will be prompted to enter in your Pi’s password. Your file will then be transferred.

Note: Linux file names cannot have spaces between them. So, what if you have a file that has a space in the name? You can either rename the file on your Mac to have no spaces between words, or you can comment out the space. Here is how you would comment out the space on a file named Test File.rtf:

scp ~/Documents/Test\ File.rtf pi@raspberrypi.local:~/Desktop/alifolder

You essentially add a \ character before the space. (If you are doing this via SSH, you will want to add \\ before the space, or in other words, you will need to comment out the comment first).

Transfer a File from a Windows PC to a Raspberry Pi

Start by downloading FileZilla onto your Windows PC (other FTP clients work but FileZilla is a free download and easy to use).

Open up FileZilla and fill in the following fields:

Host: sftp://XXX.XXX.XXX.XXX (your IP address here)
Username: (the username of your Pi )
Password: (the password of your Pi)
Port: 22

Connect, and you should see a list of files located in the below boxes. The files in the leftmost pane are the files/directories on your local PC. The files on the rightmost pane are the files/directories on your Pi.

Locate the file you want transferred on the left/PC side, then drag and drop it into the desired directory on the right/Pi side. That’s it — the file should now be on your Pi.

Transfer a File from OS X to a Raspberry Pi

Start by downloading Cyberduck onto your Mac (also available through the App Store). Other transfer clients work, but Cyberduck is a free download and easy to use.

Open up Cyberduck and click on File – Open Connection.
Choose SFTP from the dropdown box, then fill out the fields as follows:

Server: (your IP address)
Port: 22
Username: (the username of your Pi)
Password: (the password of your Pi)
Uncheck the box for Anonymous Login.

Connect, and a box will come up that shows the files/directories currently on your Pi. Locate the file you want to transfer on your Mac, then drag and drop it into the desired directory in the SFTP Cyberduck window. Done!


Source: http://thomasloughlin.com/how-to-transfer-files-from-a-mac-or-pc-onto-a-raspberry-pi/