Perform rsync while following sym links
Solution 1:
The -L
flag to rsync will sync the contents of files or directories linked to, rather than the symbolic link.
Solution 2:
Just ran into this problem. And if you want rsync to treat symlinked directories as directories, you want the K
option
rsync -K /files/ user@server:/files/
Solution 3:
You need both -L
and -K
if you have symlinks on both sides, e.g. you already had your 1st rsync done and want to update the backup using rsync.
-L, --copy-links transform symlink into referent file/dir
-K, --keep-dirlinks treat symlinked dir on receiver as dir
In such cases, if you use only -L
, the symlinks on the receiver side will be wiped out and new real dir will be made.