Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

My source folder contains only symbolic links to different directories:

symlink1 -> /path/to/dir1

symlink2 -> /path/to/dir2

I want rsync to delete synch'd links from the source on success. I tried adding --copy-links to follow symblinks and --remove-source-files to remove them.

rsync -vrhuz --copy-links --remove-source-files --progress -e ssh username@remotehost:/path/containing/links /local/path

Unfortunately this will delete the files linked by the symbolic links instead of the symbolic links themself, which is I want to achieve.

Any suggestions, maybe using other techniques if rsync alone is not enough?

share|improve this question

migrated from stackoverflow.com Mar 27 '13 at 23:25

This question came from our site for professional and enthusiast programmers.

You could use --links instead of --copy-links, it will remove symlinks (not referenced links), but it will sync symlinks, not referenced directories.

share|improve this answer

You must log in to answer this question.