rsync exclude
I sometimes wonder why --exclude-like options in MAN-pages always note, --exclude=PATTERN. Almost always I think of regular expressions, but it never seems to be the case. Instead it's much, much easier.
Here is an example usage of rsync with exclude:
So what happens here?rsync -avzth \
--exclude="*error_log" --exclude="*/tmp/*" \
--progress \
-e ssh \
root@82.96.x.x:/web /web/
Instead of copying the files of server-A to server-B from server-A, I instead started the process from server-B! Complicated but it works! So yeah, why would I do that? Well - server-A is old and wouldn't install rsync, it's also heading straight to retirement after this is completed. Which is why I installed rsync on server-B to get the job done.
I wasn't sure at first if rsync allows you to do that, but of course it works well.
Also note I did --exclude twice - once to exclude all error_log files (who needs them anyway) and once to exclude all directories tmp. And it worked like a charm! I am not even sure if rsync treats all --exclude options like a path, so I specified a wildcard ("*") just to make sure.