From fc47d8151230b61cc5b6adbb92ee65599ef0e493 Mon Sep 17 00:00:00 2001 From: Guido Cella Date: Mon, 5 Jul 2021 16:50:03 +0200 Subject: properly avoid reuploading non-modified files -u does not avoid reuploading files that haven't been changed since the last upload. That is the default behavior and can only disabled with --ignore-times, -I. But for that to work, you need transfer modification times with -t. What -u does is skip uploading files that have a newer modified time on the DESTINATION, which is not something that you commonly need. For example, if you store translation strings in files, and both you and the website owner modify them, you can use -u to ensure that you don't overwrite newer translation files on the server when you upload, without having to remember to download new changes before every upload. They would otherwise be overwritten even if you haven't modified your local files lately. If you don't transfer the modification times, the versions on the destination will have the modified time of the upload which is newer than the last time they were modified locally, and so -u will skip uploading them because they are newer on the receiver, but it's not meant to be used for that. You should normally just use -t. With -u you also risk that if the files on the server have been modified for some reason after their local counterparts, they won't be updated on uploads. --- rsync.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'rsync.html') diff --git a/rsync.html b/rsync.html index c18e92b..7dae341 100644 --- a/rsync.html +++ b/rsync.html @@ -20,14 +20,14 @@
apt install rsync

Uploading files with rsync

From your local machine you can upload files to your server like this:

-
rsync -ruvzP /path/to/file root@example.org:/path/on/the/server
+
rsync -rtvzP /path/to/file root@example.org:/path/on/the/server

You will be prompted for the root password and then uploading will commence.

If you omit root@, rsync will not attempt to log in as root, but whatever your local username is.

Options to rsync

In this command, we give several options to rsync: