开发者

rsync using --delete but want to not delete symlinks at destination

开发者 https://www.devze.com 2023-02-07 04:22 出处:网络
Using rsync, my source directory has a number of files and directories. My destination already has been synced, so it mirrors those files and directories.

Using rsync, my source directory has a number of files and directories. My destination already has been synced, so it mirrors those files and directories.

However, I have manually created a symlink in my destination tha开发者_运维技巧t does not exist in my source.

I need to use the --delete operation in rsync. Is there a way to get rsync to not remove the symlink?


There is no option to achieve this the way you suggested BUT the simplest solution to the described problem is just to add the filenames of the symlinks to the rsync exclude pattern

like: --exclude="folder/symlinkname1" --exclude="folder/symlinkname2"

if there are many symlinks you can keep a list of them in a exclude pattern file this file may be autogenerated by a little script or a bash one liner...


Does your destination existing symlink point to a directory or file? If a directory, you may be able to use --keep-dirlinks.

0

精彩评论

暂无评论...
验证码 换一张
取 消