How to exclude multiple directories with rsync?

Geeky question:

This is what people and friends have tried:

rsync -arv --exclude "/home/john/.ccache:/home/ben/build" /home/john /media/ben/thumbdrive/

Answer:

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/john /media/john/thumbdrive/

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

A big thank you for Ubuntu forums for the same!

Akash Angle

I am a Full time Linux user who has quit using Windows for unknown reasons, making my life truly open source.

Recent Posts

systemd-resolve command not found in Ubuntu Desktop

Use resolvectl status instead. It's like something deprecates and suddenly things get broken! In systemd…

5 months ago

How to resolve apt-get -f not working

You might encounter this error which appears to be very common on Debian based Distro's…

5 months ago

How to install Broadcom STA wireless drivers on Kali Linux

PS: This article is for only Kali Linux users, that too having a Broadcom Wireless…

5 months ago

Disable Nvidia X server in Ubuntu Linux

Ubuntu Linux comes with some open source drivers and there might be some vendor locking…

5 months ago

Unable to install FLUXION 5.9 on Ubuntu 18.04 LTS

Fluxion is a security and auditing tool re-search tool, it is a remake of the…

5 months ago

Ubuntu does not boot properly

I've come across this issue, many a times in my personal Desktop Linux chores. And…

5 months ago