If you’re using a command-line backup tool, most of them support an exclude option.
Below are the most common ones; just add the --exclude flag (or an exclude file) to your command.

| Tool | Example |
|---|---|
| rsync | rsync -av --exclude='/path/to/folder' /src/ /dest/ |
| tar | tar --exclude='/path/to/folder' -czf backup.tar.gz /src/ |
| borg | borg create --exclude '/path/to/folder' repo::archive /src/ |
| restic | restic backup /src/ --exclude '/path/to/folder' |
| duplicity | duplicity --exclude='/path/to/folder' /src/ file:///dest/ |
If you have several directories to exclude, you can:
- Add multiple
--excludeflags, e.g.--exclude '/a' --exclude '/b'. - Put the patterns in a file and use the tool’s “exclude-file” option (often
--exclude-fromor--exclude-file).
Example for rsync:
`bash
# exclude.txt
/path/to/folder
/another/dir
rsync -av --exclude-from='exclude.txt' /src/ /dest/
Tip: Check your tool's –help or manual page for the exact flag name (–exclude, –exclude-from, –exclude-file`, etc.). If you’re using a GUI or a different backup program, look in its settings or documentation for an “Exclude” or “Ignore” option.

