I have a software project that uses a specific directory structure for configuration files. Symlinks are used to point to the config files currently in use. I'm in the process of making a custom installer script for CentOS 7.
I use another script to bundle the directory structure and the installer script. The bundle script uses rsync to copy the directory structure with all default symlinks intact. It also excludes the hidden svn folders.
rsync -a --exclude=".*" [sourceFolder] [bundleFolder]
The install script uses cp to install the directory structure (default symlinks intact) to the user specified location.
cp -rP [bundleFolder] [installLocation]
This all works great.
However, I also need the installer script to be able to update an existing installation. The problem with this is that I need to be able to update the config files without altering the symlinks that the user has in place.
Is there a way to copy the entire directory structure (all folders and sub-folders) but ignore any symlinks? I'm trying to avoid having to use find to parse the entire structure in a bash script just to ignore the symlinks. I assumed that this would be a common task that cp or rsync would have an option for. I haven't been able to find one though.
man rsync
and reading the options that pertain to links. Specifically, the--safe-links
flag: "This tells rsync to ignore any symbolic links which point outside the copied tree." Or, perhaps the--no-OPTION
option that enables you to do things like--no-links
--safe-links flag
but that one didn't work for my scenario. Apparently I missed the--no-links
option though. It does exactly what I need.--no-OPTION
to omit whateverOPTION
is