Page 1 of 1

Rsync directory tree with symlinks

Posted: Tue Mar 25, 2014 11:35 pm
by ^rooker
I wanted to backup an image of a directory structure on a server using rsync. I've found a handful of articles and knowledge base entries which said it can be done with this:

Code: Select all

$ rsync -a -f"+ */" -f"- *" source/ destination/
The command seemed alright, although I prefer the more readable form:

Code: Select all

$ rsync -a --include='*/' --exclude='*' source/ destination/
Looking good, but didn't move a finger in my setup. :?

I've used symlinks for gathering multiple partitions together in the source-dir I wanted to copy the directories from with rsync.

The solution is to add a "-k" to the rsync command:
-k, --copy-dirlinks transform symlink to dir into referent dir
So the correct command for this case looks like this:

Code: Select all

$ rsync -ak --include='*/' --exclude='*' source/ destination/
Links: