How To Download and Upload Directories Recursively In Linux – POFTUT

How To Download and Upload Directories Recursively In Linux


scp is popular protocol and command used to download and upload files and directories in a secure manner. We have all ready examined most of the scp command features in the following tutorial. In this tutorial we will learn hoe to copy directories or folders recursively with scp .

Linux Scp Command Usage With Eamples

Recursive Option

-r option is used to download or upload files recursively. The copy direction is not important. So for all copy directions recursivity is enabled. It is expressed like below.

$ scp -r

Download Directories Recursively

We will start download directories or folders recursively from remote system to the local system. In this example we will download directories from IP address 172.16.110.35

$ scp -r 172.16.110.135:/home/ismail/test_bak /home/ismail/other
Download Directories Recursively
Download Directories Recursively

Upload Directories Recursively

In this example we will upload given directory content to the remote system recursively.

$ scp -r Desktop/ 172.16.110.135:/home/ismail/test_bak
Upload Directories Recursively
Upload Directories Recursively

Preserve Modification, Access Times and Modes

While uploading and downloading files and directories recursively we may need to preserve the file and directories modification and access times with modes. So we can use -p option to preserve given attributes.

$ scp -r -p Desktop/ 172.16.110.135:/home/ismail/test_bak

Use Compression

Recursive operations generally transmits a lot of data. We can use the -C option in order to compress transmitted data. This will made our transfer faster while using less bandwidth.

$ scp -r -C Desktop/ 172.16.110.135:/home/ismail/test_bak
Use Compression
Use Compression

LEARN MORE  Linux Rsync Exclude File,Directory and Folder Examples

Leave a Comment