Dino Geek, try to help you

How to use RSYNC to sync two folders on the same computer?


RSYNC (Remote Sync) is a Unix-based command line utility that is popular for synchronizing files and folders between different locations. These locations can be on the same computer or between two different machines. It uses a “delta transfer algorithm” to transfer only the parts of files that have changed, hence making transfers more efficient.

Let’s go over step-by-step how you can use Rsync to sync two folders on the same computer:

1. Open your terminal in Unix/Linux or Command Prompt/PowerShell if you’re on a Windows system.

1. The basic structure of an Rsync command is as follows:

`rsync options source destination` The `source` is the file/folder you wish to copy from, and the `destination` is the location you wish to copy to.

1. If you want to sync two directories, for example, directories named “folder1” and “folder2”, the command would appear like this:

`rsync -r /path/to/folder1/ /path/to/folder2/` In this command, `-r` or `—recursive` option tells Rsync to copy the directories recursively.

1. If you want to sync files and directories, preserve timestamps, hard links, symbolic links, and permissions, delete items in the destination folder that are not in the source folder, and view progress as it happens, an example command might look like:

`rsync -avh —delete —progress /path/to/folder1/ /path/to/folder2/`

The descriptions of the options used in the above command are:

- `-a` or `—archive`: This option does many things. Notably, it recursively copies files, preserves symbolic links, file permissions, user & group ownerships, and timestamps. It does not preserve hard links because it would complicate things.

- `-v` or `—verbose`: This option makes Rsync show the progress of the files that are being transferred.

- `-h` or `—human-readable`: This option makes the file sizes more human-readable.

- `—delete`: This option removes files on the receiving side that do not exist on the sending side.

- `—progress`: This option shows the progress of the transferred files.

This guide has been developed referencing information from ‘Linux man pages’ for the tool and ‘GeekStuff’ Linux tutorials.

Remember, when using RSYNC, always take care to ensure that you’re copying in the correct direction (from `source` to `destination`) to avoid deleting or overwriting valuable data. A good practice is to make sure your backup routine includes a proper and regular validation that data is backing up as you expect, to minimize the risk of data loss.

Sources:
- https://www.geekstuff.com/2010/09/rsync-command-examples/
- https://www.computerhope.com/unix/rsync.htm
- https://linux.die.net/man/1/rsync


Simply generate articles to optimize your SEO
Simply generate articles to optimize your SEO





DinoGeek offers simple articles on complex technologies

Would you like to be quoted in this article? It's very simple, contact us at dino@eiki.fr

CSS | NodeJS | DNS | DMARC | MAPI | NNTP | htaccess | PHP | HTTPS | Drupal | WEB3 | LLM | Wordpress | TLD | Domain name | IMAP | TCP | NFT | MariaDB | FTP | Zigbee | NMAP | SNMP | SEO | E-Mail | LXC | HTTP | MangoDB | SFTP | RAG | SSH | HTML | ChatGPT API | OSPF | JavaScript | Docker | OpenVZ | ChatGPT | VPS | ZIMBRA | SPF | UDP | Joomla | IPV6 | BGP | Django | Reactjs | DKIM | VMWare | RSYNC | Python | TFTP | Webdav | FAAS | Apache | IPV4 | LDAP | POP3 | SMTP

| Whispers of love (API) | Déclaration d'Amour |






Legal Notice / General Conditions of Use