Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a directory that contains symbolic links to other directories located on different media on my system:

/opt/lun1/2011 /opt/lun1/2010 /opt/lun2/2009 /opt/lun2/2008 /opt/lun3/2007

But the symbolic links show up as:

/files/2011 /files/2010 /files/2009 /files/2008 /files/2007

How can I perform an rsync that follows the symbolic links?

e.g.:

rsync -XXX /files/ user@server:/files/

share|improve this question

1 Answer 1

up vote 17 down vote accepted

The -L flag to rsync will sync the contents of files or directories linked to, rather than the symbolic link.

share|improve this answer
    
When I do this, all the receiver symbolic links get deleted and my sender starts re-sending the files. –  ensnare Mar 10 '11 at 16:40
    
Isn't that what you want? I thought you wanted to have the real files on the receiving side, not just the symlinks. Do you mean you want the symlinks copied as symlinks, but automagically rewritten to point to the "right" place on the receiving system? If so, that's not what is normally meant by "an rsync that follows the symbolic links". –  MadHatter Mar 10 '11 at 17:10
    
It actually deletes the symbolic links and replaces them with the files. I want to follow the symbolic links through as if they were regular directories. –  ensnare Mar 10 '11 at 17:53
    
Are these symbolic links to files, or to directories; your comment above suggests both? Could you paste an example of what you've got on the source side and what you would like to see on the destination side, in the original question? And by example, I mean some detail: ls -al output from the source side. –  MadHatter Mar 10 '11 at 17:59
    
Hi -- these are directories. I got this to work with the -K flag. –  ensnare Mar 10 '11 at 21:20

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.