Reputation: 5550
I'm trying to back up a server with an rsync script automated with cron. Right now I'm using the command:
rsync -avz --progress --exclude-from "/Users/user/Scripts/exclude.txt" -e ssh user@server:$REMOTE_PATH $LOCAL_PATH > /tmp/rsync.log
with $REMOTE_PATH and $LOCAL_PATH defined in the bash script.
I have a directory called #recycle that I'm trying to skip, and am unsure how to exclude it with a file. If I use the option --exclude '#recycle/', then it skips the directory just fine. However, if I include the option above with an --exclude-from tag, with the file only containing the line:
#recycle/
then it doesn't work. I've also tried \#recycle/
, but escaping the pound sign doesn't seem to fix the issue. I'm pretty sure that the pound is causing all of the issues, but I don't have any control over the directory names. Any thoughts on how to fix this?
thanks!
Upvotes: 5
Views: 3623
Reputation: 123570
Lines starting with #
are ignored in exclude files, yes.
You can instead use [#]recycle
which matches the same thing, but is not discarded as a comment.
Upvotes: 7