I am trying to backup my home directory using rsync, and I want to exclude some of the directories that contain junk. I want to specifically exclude /home/ben/.ccache
and /home/ben/build
. Unfortunately the documentation for rsync was information overload and didn't answer my question. This is what I tried:
rsync -arv --exclude "/home/ben/.ccache:/home/ben/build" /home/ben /media/ben/thumbdrive/
What is the right way to do this?
Best Answer
OK I feel really dumb. Before I even posted this question my friend showed me how to do it and it is really simple. To exclude multiple directories you just use multiple
--exclude=path
switches. So my command above properly written is as follows:Note: Use relative paths with exclude. The paths are relative to the source directory, here /home/ben.