Skip to content

Instantly share code, notes, and snippets.

@shawnbutts
Forked from kylemanna/7z+tar.md
Created June 4, 2016 16:53
Show Gist options
  • Save shawnbutts/557b5694f9db7d6ab256cdc5afe2fd12 to your computer and use it in GitHub Desktop.
Save shawnbutts/557b5694f9db7d6ab256cdc5afe2fd12 to your computer and use it in GitHub Desktop.
Archive with tar + 7z + max compression

Overview

7-zip doesn't preserve the Linux/Unix owner/group of files and possibly other details. Use tar instead because it's designed to preserve these things, then just 7zip the tar archive.

Create the archive

tar cf - --exclude=\*.o -v directory | 7z a -si -t7z -m0=lzma -mx=9 -mfb=64 -md=32m -ms=on directory.tar.7z

Extract the archive

7za x -so directory.tar.7z | tar xf -
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment