How to exclude directories with certain names from rsync on Linux?

How to exclude directories with certain names like "cache" from rsync on Linux during backup?

The "cache" directory may in many different paths, such as file1/cache/ or file2/cache/, and adding all "cache" directories to rsync command is not a doable way.

asked Dec 17, 2014 by anonymous

1 Answer

You can use rsync with --exclude=cache/ like

rsync -avxP --exclude=cache/ /path/to/src/directory/ /path/to/dst/dir/
answered Dec 17, 2014 by Eric Z Ma (44,280 points)

Please log in or register to answer this question.

Copyright © SysTutorials. User contributions licensed under cc-wiki with attribution required.
Hosted on Dreamhost

...