Reputation: 57660
I am rsyncing files from localhost
to host1
using the following command.
rsync -vq -ar \
--exclude="index.php" \
--exclude="var*" \
--exclude=".svn*" \
--exclude="*~" \
--exclude="Doxyfile" \
--exclude="*.kdev*"
--exclude="nbproject" \
${SRC} root@${HOST}:${RLOC} && echo Files synchronised.
The problem with this command is it excludes index.php
from any directory. But I want to exclude it only from root. That is I want ${SRC}/index.php
should not be copied. But other will. How can I achieve this?
Upvotes: 2
Views: 1184
Reputation: 968
All rsync exclude paths use relative position to the source directory. So if you do --exclude="/index.php" it works how you want. But make sure ${SRC} has a trailing slash.
Upvotes: 4