•  Home
  •  Dashboard
  •  Company
    • About Us
    • Blog
    • Careers
    • Contact Us
    • Data Centers
    • Looking Glass
    • Network
    • Reseller
  •  Hosting Services
    • Infrastructure
      • iColocation
    • Compute
      • cMetal
      • cVirtual
    • Storage
      • sObject
      • sBlock
    • Networking
      • nCDN
      • nIP Transit
      • nWavelength
    • Protection
      • pBackup
      • pDDoS
  •  Solutions
    • Ecommerce
    • Finance
    • Gaming
    • Hosting
    • Management
    • Security
    • System Integrator
  •  Support
    • Community
    • Knowledge Base
    • Open A Ticket
  •  USA & Canada: 800-933-1517
  •  International: 626-549-2801
  •  Email: sales@psychz.net
  • Services
    • new-colocation-header-img
      Infrastructure
      • iColocation
    • new-compute-header-img
      Compute
      • cMetal
      • cVirtual
    • new-storage-header-img
      Storage
      • sObject
      • sBlock
    • new-networking-header-img
      Networking
      • nCDN
      • nIP Transit
      • nWavelength
    • new-protection-header-img
      Protection
      • pBackup
      • pDDoS
  • Solutions
    • Ecommerce
    • Security
    • Gaming
    • Hosting
    • Management
    • Finance
    • System Integrator
  • Dashboard

Rsync Two Directories

  • Home
  • Client
  • Qa Forum
  • Rsync Two Directories

Posted By: ling | 1 Replies | Last Reply On: Jul 11, 2017 02:04:28

How to rsync two directories? 

Psychz - Manish

Votes: 0Posted On: Jul 11, 2017 02:04:28
 

"rsync" is a versatile copying tool provided by Linux distributions. It is used to copy files locally to/from a remote host over any remote shell. rsync is best used for synchronization of files in the case of backup and mirroring. You can keep your data safe by copying sensitive data to the remote host and retrieving it whenever required. It also contains options through which you can perform operations. The "rsync" command updates the folder by adding the new files to be copied and avoid the overwriting of files.


Prerequisites

1. "rsync" should be installed on your system. To check if rsync is installed, run the following command.

   
   rsync --version

 

2. If the rsync command is not installed, install it by running the following command.

 
   RPM based Operating Systems - yum -y install rsync
   Debian/Ubuntu - apt-get install rsync 

3. Make sure that the IP is whitelisted on the firewall of both the remote and local system.

4. An established SSH connection between remote and local machine.


A Push Operation

Copying of files from local to remote system is called a "push" operation. The syntax of the command is as follows.

 rsync -a path_of_local_directory username@remote_host:destination_directory


A pull operation 

Copying of files from remote to local machine is called a pull operation. The syntax of the command is as follows.

rsync -a username@remote_host:path_of_remote_directory place_to_sync_on_local_machine


The "rsync" command has a lot of options to use with it. Some of the important options are discussed below.

# "-a" option is the same as -rlptgoD. Here are some of the functions that "-a" option performs.

1.Descend recursively into all directories (-r),
2.copy symlinks as symlinks (-l),
3.Preserve file permissions (-p),
4.Preserve modification times (-t),
5.Preserve groups (-g),
6.Preserve file ownership (-o), and
7.preserve devices as devices (-D).

# "-z" option is used to compress files while sending them.

# "-P" option is the same as --partial and --progress. 
   
   --partial - It is used to resume the interrupted transfers.
   --progress - It is used to display the progress bar of the transfers.

# "-v" - It is used to display the result in a more verbose manner.

The "rsync" command comes with numerous options. It is recommended to use the "man" command with rsync to master all the options. The command is as follows.

man rsync

 

Was this reply helpful?

Related topics

  • How to rsync two directories
  • sBlock - Backup on RHEL, CentOS, AlmaLinux & Rocky Linux
  • sBlock - Backup on Debian, Ubuntu and Related OS
  • Basic and useful Linux commands
  • Top Five Open Source Backup Software for Linux
  • Rsync over SSH
  • Linux Command for Find Directory
  • How to use rsync over SSH?
  • How To Find Large files and directories on Linux ?
  • Linux File Permissions Cheat Sheet
  • Difference between Unix and Linux
  • EasyApache 4: better than ever?
  • Deploy Psychz Dedicated Server Using Terraform Provider
  • In Comparison: Windows VS Linux
  • Dropbox flourishes after migrating to its own infrastructure from Amazon Web Services
Copyright © 2025 Psychz Networks,
A Profuse Solutions Inc Company
Hosting Services
Infrastructure
  • iColocation
Compute
  • cMetal
  • cVirtual
Storage
  • sObject
  • sBlock
Networking
  • nCDN
  • nIP Transit
  • nWavelength
Protection
  • pBackup
  • pDDoS
Company
  • About Us
  • Blog
  • Careers
  • Contact Us
  • Data Centers
  • Looking Glass
  • Network
  • Reseller
Policies
  • Acceptable Usage Policy
  • Privacy Policy
  • Service Level Agreement
  • Terms and Conditions
Support
  • Community
  • Knowledge Base
  • Open A Ticket
Get In Touch
  • Psychz Networks,
    A Profuse Solutions Company
    611 Wilshire Blvd #300
    Los Angeles,California 90017
    USA
  • US/Canada: 800-933-1517
  • International: 626-549-2801