rsync - incremental file list sent but files not updated on server
In short, this is not the correct command...
$ rsync -av ./2016-07-01 user@server:./path-to-project/2016-07-01
This is the correct command...
$ rsync -av ./2016-07-01 user@server:./path-to-project
Note, no forward slash or directory name for destination - when these are left off rsync
will create the directory as required. I think the /
and 2016-07-01
imply 2 different things should be done. No /
means create directory. I am not sure what the effect of adding/removing the 2016-07-01
is if the /
is there. Perhaps someone can clarify this.
Also note there are 3 ways of addressing the destination on the remote server.
Using the above method starting the address with
.
. The rsync command defaults to the users home directory, so this relative path to the home directory works.One can also type out the full absolute path from the root directory. For me this is something like
/afs/servername/u/username/rest_of_path_from_home_dir
Finally, using the
~
expansion as a shortcut for the above will also work.
Related videos on Youtube
user3728501
Updated on September 18, 2022Comments
-
user3728501 over 1 year
I am working with some source files from a desktop computer. The source files compile and run on a remote server.
As there is a significant delay between me and the server, I have decided to use
rsync
to copy the files down to my computer, edit them, and then sync them back up, again usingrsync
.However there is a problem...
rsync
doesn't update the files when I sync them back up to the server after editing them at my end. The incremental file list is sent, but the file contents are unmodified.Here is a full output of my bash session which will explain in detail what happens.
- I have some files on my local machine. I edit one of those files, using an editor such as
vim
. The file structure is fairly generic. I have a project root directory called2016-07-01
, which contains many subfolders and source files. The folder is just named with the date as a method of version control.
(bash)
$ rsync -av ./2016-07-01 user@server:./path-to-project/2016-07-01 user@server's password: [enter password] sending incremental file list 2016-07-01/subfolder/ 2016-07-01/subfolder/main.cpp sent 2,238 bytes received 272 bytes 557.78 bytes/sec total size is 632,957 speedup is 252.17
It looks like main.cpp has been updated, but when I
ssh
into the server and open it withvim
I see that it is unchanged. Why is this happening?I then run the same command again and the following output is produced...
(bash)
$ rsync -av ./2016-07-01 user@server:./path-to-project/2016-07-01 user@server's password: [enter password] sending incremental file list sent 1,342 bytes received 36 bytes 110.24 bytes/sec total size is 632,957 speedup is 459.33
This time no incremental file list is sent - I am not sure why - it is as if
rsync
thinks it has updated the files already and therefore does nothing when it has not...If I check
main.cpp
at my end it has definitely been changed.main.cpp
on the server side is unchanged.
I have also tried using the
-c
flag for checksums rather than date-time-stamps, again the same result is seen.-
JasonAzze almost 8 yearsYou are rsyncing to "user's" ~/path-to-project/2016-07-01. Is that where you are looking when you ssh to the server and open the file?
-
user3728501 almost 8 years@JasonAzze It is not. How can I get the '~' for "user" on the SERVER side?
- I have some files on my local machine. I edit one of those files, using an editor such as