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?

1 Answer 1


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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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