Friday, May 3, 2024
313
rated 0 times [  313] [ 0]  / answers: 1 / hits: 368216  / 2 Years ago, thu, march 24, 2022, 2:35:41

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?


More From » command-line

 Answers
4

To exclude multiple directories you just use multiple --exclude=path switches. So the command from the question properly written is as follows:


rsync -arv --exclude=.ccache --exclude=build /home/ben /media/ben/thumbdrive/

Note: Use relative paths with exclude. The paths are relative to the source directory, here /home/ben.


[#30312] Thursday, March 24, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
mugustered

Total Points: 193
Total Questions: 123
Total Answers: 108

Location: Bermuda
Member since Wed, Mar 22, 2023
1 Year ago
;