How-to Guide: Rsync Multiple Folders & Easier Way
Rsync can help you copy files between systems, mirror data, and do incremental backups. Learn how to use Rsync to sync multiple folders easily on this page.
User Case: How Do I Sync Two Folders with Rsync?
I'm trying to sync three folders and all their contents from a remote server to a local folder using Rsync. How can I achieve that? What options should I use for Rsync multiple folders? Do you guys have any ideas?
About Rsync
Rsync (Remote Sync) is a powerful command-line tool that can help you copy and synchronize files between two locations, either on the same system or over a network. For example, you can use it to sync two hard drives, copy files between two servers, perform data backups, and mirror between two Linux machines.
Advantages of Rsync
There is no doubt that Rsync is a powerful sync tool with a variety of use cases. Some key advantages of this utility include:
- Efficient file transfer/backup: It transfers only the differences between the source and the destination, and allows to perform incremental backups, rather than copying entire files. This minimizes the amount of data sent over the network.
- Remote data synchronization: It supports both local and remote file transfers over SSH, enabling sync between local and remote systems, or mirroring directories on multiple machines.
- File permission preservation: It preserves file attributes such as permissions, ownership, timestamps, and symbolic links, ensuring that copied files retain their original characteristics at the destination.
Common Rsync Command Syntaxes
The basic syntax of Rsync is # rsync [options] source destination. To make sure that you can use Rsync to sync two folders or multiple folders/files clearly, there is a list of some frequently-used Rsync options:
✅ source: Define the origin of the files or directories to be transferred, which may be either a local or remote location.
✅ destination: Indicate where the files or directories will be copied to, which can be either a local or remote path, similar to the source.
✅ -a: Enable archive mode, which supports recursive copying while preserving symbolic links, file permissions, ownerships, and timestamps.
✅ -v: Provide verbose output, showing comprehensive details about the transfer.
✅ -z: Compress data during the transfer, reducing bandwidth consumption.
✅ -h: Produce output in a format that is easier to read by humans.
✅ -p: Display the progress of the transfer.
✅ -r: Recursively copy data but do not maintain timestamps or permissions during the transfer.
Step-by-Step Guide: How to Rsync Multiple Folders
To Rsync multiple files or multiple folders via command line or utilize Rsync to sync with a remote system, you need to ensure SSH access is configured between your local and remote machines, as well as Rsync installed on both systems. Then, try the following methods:
#1. Specify Multiple Source Directories
You can specify Rsync multiple directoriesin the command directly, appending each folder to the command, followed by the destination. This method is straightforward but can be cumbersome with a large number of folders:
>> rsync -av /path/to/source1/ /path/to/source2/ /path/to/destination/
This command synchronizes both /path/to/source1/ and /path/to/source2/ to /path/to/destination/.
#2. Use a Symlink Directory
A more scalable approach involves creating a directory that contains symbolic links (symlinks) to all the directories you want to sync. This setup minimizes the complexity of the Rsync command itself and is ideal for scenarios where the list of directories changes over time:
- Create a new directory, e.g., ~/tobackup/.
- Within this directory, create symlinks to each of the directories you wish to sync.
- Use the Rsync command with the -L option, which tells Rsync to treat symlinks as the directories they point to:
>> rsync -aL ~/tobackup/ /path/to/destination/
This method requires maintaining the symlink directory, but it simplifies the Rsync command and makes it easy to update the list of folders being synced.
Easier Way to Sync Multiple Folders - Free & Intuitive
AOMEI Backupper Standard is a professional yet free file sync software, supported on Windows 11, 10, 8.1, 8, 7, Vista, and XP, both for 32 bit and 64 bit. It comes with a user-friendly interface and offers various sync functions:
- Complete sync locations: It offers to sync files from one folder, disk, or computer to another, so you can easily transfer files across PCs.
- Various sync options: Its Basic Sync lets you sync one way from source to destination; Mirror Sync, Real-Time Sync, and Two-Way Sync are also provided for advanced sync needs. (the latter 3 options available in Pro version)
- Scheduled sync: It provides 5 sync modes including Daily, Weekly, Monthly, Event triggers, and USB plug in to help you keep files updated automatically.
How to Sync Multiple Folders using AOMEI Backupper Standard
To sync multiple folders from one hard drive to another or from one computer to another using AOMEI Backupper, you can follow the steps below:
Step 1. Install and run CBackup on your computer.
Step 2. Select Sync from the left side, and click on Basic Sync.
Step 3. Tap on Add Folder to choose the folders you wish to synchronize. Then, select your sync destination path.
Step 4. You could click Schedule Sync to set up automatic sync if needed. Then, hit Start Sync to sync multiple folders with ease.
To Sum it up
On this page, we have covered how to use Rsync to sync multiple folders. However, it should be noted that this method may be difficult for those who are not too familiar with the command line, and is prone to failing folder synchronization due to incorrect options. Therefore, a simpler approach is to turn to an easy-to-use file synchronization tool like AOMEI Backupper.
It offers one way sync, two way sync, and other sync features; also, you can use it to backup and restore files to/from various locations, and clone hard drive to SSD or other drives quickly and easily.