Skip to content

Instantly share code, notes, and snippets.

@ethanpil
Created November 25, 2021 17:28
Show Gist options
  • Save ethanpil/b1631dd259ac0f601a6cd41dff1dc202 to your computer and use it in GitHub Desktop.
Save ethanpil/b1631dd259ac0f601a6cd41dff1dc202 to your computer and use it in GitHub Desktop.

Using tar you can exclude directories by placing a tag file in any directory that should be skipped.

Create tag files,

touch /sys/.exclude_from_backup
touch /proc/.exclude_from_backup

Then,

tar -czf backup.tar.gz --exclude-tag-all=.exclude_from_backup *

Gleaned from https://stackoverflow.com/a/13296077

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment