Rsync create symbolic links only

2019-04-28 07:15发布

I currently have rsync working well. It copies all my files from one directory to another directory. The only thing is it is physically copying the files.

I have a lot of large files that I don't want to have a duplicate of all the files. I just want to create a symbolic link in the new directory so that I can serve the data on a webpage. The source directory has some scripts and files I don't want the public to see. I'm moving the safe data to the web root (destination).

What I would like rsync to do is any new files in the source directory would create links into the destination. That way I am not using up my hard drive space like I currently am doing. What I have works perfect except for doing the symbolic link aspect to it. Is there a way to have rsync track and create symbolic links?

rsync -aP --exclude="file.sql" --exclude="*~" --exclude=".*" --exclude="*.sh" . ${destination}

标签: shell unix rsync
1条回答
仙女界的扛把子
2楼-- · 2019-04-28 08:12

Can lndir be useful to you. According to manual it creates a shadow directory of symbolic links to another directory tree.

查看更多
登录 后发表回答