top of page
  • Writer's pictureRahul R

How to move a folder from one Linux server to another using SCP

Transferring files or folders between servers can be a time-consuming process, especially when you have large amounts of data to move. Fortunately, if you have shell access to both servers, you can use the Secure Copy (SCP) command to transfer files and folders quickly and securely.

The basic syntax of the SCP command is as follows:


scp -r <username>@<ip_address>:<source_path> <destination_path>

Let's break down each element of the command:

  • <username>: This is the username for a valid user on the source server.

  • <ip_address>: This is the IP address or hostname of the source server where the files or folders are located.

  • <source_path>: This is the path to the files or folders that you want to copy on the source server.

  • <destination_path>: This is the path where you want to copy the files or folders on the destination server.

Note that the -r flag is used to copy directories and their contents recursively. If you're only copying a single file, you can omit this flag.

Once you've entered the command, you'll be prompted to enter the password for the source server. After you've entered the correct password, the file transfer will begin, and you'll see a progress bar indicating the status of the transfer. When the transfer is complete, you'll see a prompt to indicate that the transfer has finished.

Here's an example command to copy a directory called "my_folder" from a server with IP address 192.168.1.100 to the current directory on the local machine:


scp -r user@192.168.1.100:/home/user/my_folder .

In this example, we're using the dot (.) to specify the current directory as the destination path. If you want to specify a different destination path, you can replace the dot with the appropriate directory path.

By using the SCP command, you can easily transfer files and folders between servers without having to download and upload the data manually. This can save you a lot of time and effort, especially when you're working with large amounts of data.


12 views0 comments

Recent Posts

See All

How to setup reverse proxy on apache2

To set up a reverse proxy to a local installation using Apache2, you need to configure the Apache Virtual Hosts to forward requests to your local server. Here's a step-by-step guide: Enable Proxy Modu

How to Set Up Odoo with Apache Reverse Proxy on Ubuntu

Welcome, adventurous souls, to the whimsical world of Odoo installation! In this zany tutorial, we'll embark on a wild journey to set up Odoo, the beloved open-source ERP software, with an Apache reve

How to Attach S3 to your Django Project

Install Required Packages: Install django-storages package, which provides support for various storage backends including Amazon S3. You can install it via pip: pip install django-storages Configure D

Comments


bottom of page