Dino Geek, try to help you

What is the behavior of --update option in RSYNC?


The —update option in Rsync is a crucial feature that changes the behavior of Rsync significantly and plays a crucial role in file synchronization. This Rsync option is also called “-u” for short.

Rsync (Remote Sync) is a common and powerful command-line utility in Unix-like systems, including Linux, that aids in the copying and syncing of files and directories locally or remotely. The utility is especially popular due to its capability to only send file changes, rather than sending whole files, which may save substantial time and bandwidth (Linux Handbook, 2021).

Inside several Rsync options, the —update option or “-u” is used to prevent files from being overwritten by older files. When the —update or “-u” option is activated, Rsync assures that only files that don’t exist on the receiver side or files that are newer than the existing copies are transferred. Hence, if the destination already holds a newer version of the file, the utility does not override it (Open Source, 2021).

Here is an example to illustrate this:

Assume that we have two directories: dir1 and dir2. Dir1 contains a file called test1.txt which was created at 9 AM, while dir2 contains a file also called test1.txt, but which was last modified at 10 AM. If we run Rsync with the —update option from dir1 to dir2, the test1.txt file in dir2, which was modified later (at 10 AM), will not be overwritten by the test1.txt file from dir1 which was created earlier (at 9 AM).

The command for this scenario would be as follows:
```
rsync -u dir1/ dir2/
```

If the —update option was not included, regardless of the timestamps, Rsync would have replaced the file test1.txt in dir2 with the one from dir1.

In conclusion, the —update or “-u” option in Rsync makes the utility smart enough to transfer only files that are either non-existent on the receiving side or are newer than their receiving-side counterparts. This option is especially useful when copying large amounts of data or syncing frequently updated files across directories or systems.

References:
1. “Introduction to Rsync Command in Linux”. Linux Handbook. Retrieved March, 2021 from https://linuxhandbook.com/rsync-command/
2. “10 Practical Examples of Rsync Command in Linux”. Open Source For You. Retrieved March, 2021 from https://www.opensourceforu.com/2011/08/10-practical-examples-of-rsync-command-in-linux/


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