Computer screen showing backup tool command line settings with abandoned laptop keyboard and warm glow.

If you’re using a command-line backup tool, most of them support an **exclude** option.

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.

A gnarled tree reflecting in a misty lake with gently rippling water and muted colors.
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 --exclude flags, e.g. --exclude '/a' --exclude '/b'.
  • Put the patterns in a file and use the tool’s “exclude-file” option (often --exclude-from or --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.

Author

  • I’m a dedicated journalist and content creator at newsoflosangeles.com—your trusted destination for the latest news, insights, and stories from Los Angeles and beyond.

    Hi, I’m Ethan R. Coleman, a journalist and content creator at newsoflosangeles.com. With over seven years of digital media experience, I cover breaking news, local culture, community affairs, and impactful events, delivering accurate, unbiased, and timely stories that inform and engage Los Angeles readers.”

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *