Dino Geek, try to help you

How to use RSYNC to copy only new files?


RSYNC (Remote Sync) is a popular tool used for copying and synchronizing files/directories remotely as well as locally in Linux/Unix systems. RSYNC specializes in efficiently transferring and synchronizing changes to files and directories while minimizing data transfer by sending only the differences between the source files and the existing files in the destination.

RSYNC is ideal for copying only new or changed files, because it uses the “quick check” algorithm which basically checks if the file’s size and time of last modification have changed, rather than checking the entire file content.

Here’s an example of how to use RSYNC to copy only new files:

```
rsync -av —ignore-existing /source/directory/ /destination/directory/
```

In this command:

1. `-a` stands for archive mode, which ensures that symbolic links, devices, attributes, permissions, ownerships, etc. are preserved in the copy.

1. `-v` stands for verbose, which means it will display the operations carried out during command execution.

1. `—ignore-existing` will not overwrite the files on the receiver that already exist.

The trailing `/` in the source directory is also important, as it tells RSYNC to copy the contents of the directory, rather than the directory itself.

Please note that creating or updating files in the source directory while rsync is operating can lead to unexpected results. Therefore, please ensure that no other programs are writing to the source directory during the rsync operation.

If you are using RSYNC for backup, you may also want to consider using the `-u` option. The `-u` option makes RSYNC skip any files in the destination directory that have a later modification time than the files in the source directory.

For instance,

```
rsync -auv /source/directory/ /destination/directory/
```

Above command instructs RSYNC to only replace files in the target directory that are older than the files in the source directory.

This information is derived from several reputable sources such as [`man rsync`](https://linux.die.net/man/1/rsync), and various guides on rsync usage ([Ubuntu Documentation](https://help.ubuntu.com/community/rsync), [Digital Ocean](https://www.digitalocean.com/community/tutorials/how-to-use-rsync-to-sync-local-and-remote-directories-on-a-vps)) that describe in detail how to use rsync for copying and syncing files.


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