I am trying to set up a script for copying symbolic links folder data and my idea is to set up a single folder and to create several symlinks in this folder where the rsync will then copy the data within those directories:
/backups/local/ /backups/local/etc # symlink to /etc/ /backups/local/var # symlink to /var/ /backups/local/home # symlink to /home/
This becomes an issue and concern that when the files are copied - now I have to worry about other symlinks further down the line. What I want to see happen is that it only processes the root directories symlinks to copy the next directories but any symlinks found within
/home/ are not also copied.
For testing I put another symlink to
/etc/ inside of
/home/etc and with all the options I tried it copies
/home/etc/ each time and its full file contents.
I found and tried the following options thinking that these options might be what I was looking for:
rsync -avz -L [options] # i knew this would copy everything and it did. rsync -avz -L --copy-unsafe-links [options] # copies all symlinks recursively still. rsync -avz --copy-unsafe-links [options] # still copies all symlinks file/contents recursively
I tried the --copy-unsafe-links options since it says in the man-page that root sym-links are considered unsafe so I was thinking maybe it would only copy the root sym-links.