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}
You could use cp -aR -s
(Linux or FreeBSD) or cp --archive --recursive --symbolic-link
(Linux) to create symbolic links to the source files in the destination directory instead of copies. Note that -s
is non-standard.
It's not a symlink, but you might be able to work with --link-dest=DIR
. It creates a hard link which will create a new name for the same file. This will behave similarly to a softlink as long as:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With