Excluding Directories by Name Pattern in rsync
When backing up with rsync, you often need to skip directories like cache/, node_modules/, or .git/ that appear at multiple levels in your directory tree. Listing every instance individually is impractical, but rsync’s exclude patterns handle this elegantly. Basic exclude syntax The simplest approach uses –exclude with a directory name pattern: rsync -avxP –exclude=cache/ /path/to/src/directory/…
