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.
You can use rsync
with --exclude=cache/
like
rsync -avxP --exclude=cache/ /path/to/src/directory/ /path/to/dst/dir/