How to copy files between a PC and a Raspberry Pi

One of the most common uses of a Raspberry Pi is as a storage system to make backup copies, as if it were a NAS. To manage such amount of information, we can use applications designed for this purpose. However, they are too complex if all we want to do is copy files between a Raspberry Pi and a PC or vice versa.

Just as there are different methods to transfer information between a PC and a Mac, a computer managed by Linux and a Mac, to transfer data between a Raspberry and a Windows PC, we also have different methods at our disposal, methods that we explain to you. continuation.

How to copy files between a PC and a Raspberry Pi

How to transfer data between a PC and a Raspberry Pi

The first method that will have come to mind is using the system’s SD card, however, this is the least recommended option since it implies a series of possible problems that will force us to install the operating system again.

Using a USB memory

The easiest method to transfer data between a PC and a Linux computer, in this case a Raspberry, is by using a hard drive or USB stick . A very important point to consider is the file system. Windows is not able to read drives with the file system currently used by Linux, ext4. It is also not able to read older versions like ext2 and ext3.

Although we can access its content using third-party applications or through the command line using WSL, if we don’t want to spend time installing applications or using the command line, we should use the exFAT file system.

The exFAT file system is compatible with both Windows and Linux and macOS, so we can connect it to any device regardless of its operating system to access, copy and modify its content once we have formatted the unit that we are going to use with it. exFAT file system.

Once we connect the unit to the Raspberry Pi to copy the data that we want to take to the PC, it will be mounted automatically and we can start copying the data using the graphical interface of Raspberry OS by clicking on the folder icon located at the top of the screen. the interface.

Raspberry OS Copiar archivos

Next, we select the content that we want to transfer, with the right mouse button click on Copy and go to the unit that we have connected to paste the content.

via SSH

If we don’t want to use an external hard drive or USB stick, we can use SSH to transfer data from the Raspberry Pi to the Windows PC using the Secure Copy Protocol (scp) command. The first thing we need to know is the IP of the Windows computer where we are going to copy the data. We can easily find out through the command line using:

ipconfig

IP PC Windows

If we are using the Wi-Fi connection, we must write down the number that appears in the Wireless LAN Adapter section, within the IPv4 Address section.

Next, we go to the directory where the files that we want to transfer to the PC are stored and use the following command

scp pi@ipdelpcconwindows:nombre-archivo.extensión

For example, if the IP of the Windows PC is 192.168.0.97 and the file name is rosename.mkv, the command to use is:

scp pi@192.168.0.97:elnombredelarosa.mkv

Via FTP

If we usually find ourselves in the situation of copying files between the Raspberry Pi and a PC with Windows or another operating system, the best thing we can do is use the FTP protocol , which offers support for SFTP that allows us to send files securely between devices. .

One of the best applications of this type, which is also open source, free and includes a large number of functions is FileZilla, an application that we can download for Windows through the following link . Downloading the normal version is more than enough since it offers SFTP support.

Once we have installed the application on the PC, first of all, we must know the local IP that the Raspberry is using, information that we can know using the following command from terminal:

ipconfig

This is the same command that we can also use in Windows to find out the local IP of the computer. After finding out the local IP of the Raspberry Pi, we open FileZilla and create a new connection in which we must write the IP that we have noted in Server , in Encryption select SFTP, in User pi and in Password the password that we have established. Finally, we click on Connect and navigate through the directory of the PC and the Rasberry Pi until we find the files that we want to share in both directions.

FileZilla control de sitios general

With a cloud storage platform

If our needs are to send files that take up very little space, it is not necessary to resort to some of the methods that we have shown you above, since it is intended to transfer large files and a large number of files.

We can use any cloud storage platform where we have more than enough space to upload the files we want to share with a PC. We can also use this method to copy files to a PC and a Raspberry Pi .

via email

Raspberry Pi OS includes an email manager, a manager that offers us many functions, but it is more than enough to send email files between a PC and a Raspberry Pi and vice versa. We just have to use the Attach files option to include the files we want to share, as long as they take up little space.

The mail client included in the Raspberry Pi allows us to configure both Gmail and Outlook / Hotmail accounts in seconds, we just need to know the account name and password. The application takes care of doing the rest.

Methods not recommended

Although initially using the SD card seems like the easiest and fastest method to transfer files between a Raspberry and a PC, it is the least advisable to use. We should only consider the possibility of using it if none of the methods that we have shown you above have worked.

The SD card of a Raspberry includes a partition where the boot data is stored. If we modify any boot file, the system will stop working and we will be forced to install it from scratch. Also, it is necessary to turn off the device before extracting the data, so we will not be able to transfer the data quickly between both devices while they are running.

The last reason not to recommend the use of the SD card is that it can be easily damaged if we use it regularly to transfer information from the device to a PC or vice versa. All the methods that we have shown you in this article are very simple and easy to use and configure, so it will not be necessary to use the SD card.