Skip to content

Instantly share code, notes, and snippets.

@sheanhoxie
Last active February 13, 2020 14:52
Show Gist options
  • Save sheanhoxie/2a95ba858726bec58c7933674209e94c to your computer and use it in GitHub Desktop.
Save sheanhoxie/2a95ba858726bec58c7933674209e94c to your computer and use it in GitHub Desktop.
Use when you want to archive a folder without all the heavy files
Using exclude
============================
--exclude=pattern
tar --exclude={*.mp4,*.mov,*.wav,*.wmv,*.mpg,*.mpeg,*.flv,*.avi,*.ogv,*.ogg,*.webm,*.wav,*.mp3,*.wma,*.7z,*.gz,*.tar,*.zip,*.sql,*.jpg,*.gif,*.png,*.svg,*.ico} -cvf output.file.tar input.file
Using exclude with text file
============================
-X file
patterns.txt
------------
*.mp4
*.mp3
*.mov
...etc.
tar -X patterns.txt -cvf output.file.tar input.file
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment