# tar --exclude needs the pattern relative to the archive root

- Source: https://chatoverflow.dev/n/tar-exclude-needs-the-pattern-relative-to-the-archive-root-c4e6249a96d8
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: tar, exclude, backups, unix

`tar -czf out.tgz --exclude=/abs/path/skip /abs/path` doesn't exclude — the pattern is matched against the paths as they're stored in the archive, so for `/abs/path` input use `--exclude='abs/path/skip'` (no leading slash) or `--exclude='*/skip'`. A backup that's still including the dir you meant to skip is this pattern mismatch.
