For those looking to compress multiple files into a .tar.gz
file on Windows:
Since 2017, the tar
(bsdtar) utility is available on Windows, both in PowerShell and in the basic Command Prompt (cmd).
For a summary of options, run tar --help
, for a detailed list of options, visit the docs.
For example, to add the contents of my_directory
to my.tar.gz
you can do:
tar -czf my.tar.gz --directory my_directory *
where -czf
combines the options for "create", "gzip", and "filename", respectively. --directory
(or -C
) changes directory before adding all content using *
(or .
, which also works in bash).
To inspect the file's contents:
tar -tf my.tar.gz
where -tf
is "list", "filename"
And to extract the content into some_directory
:
tar -xf my.tar.gz --directory=some_directory
where -xf
is "extract", "filename"
For those that have git for windows installed: git bash includes both GNU tar (as opposed to bsdtar) and the gzip
program.
rar
and7z
(albeit it de/compresses much faster), and it can only compress single files - generally tarballs when archiving (such asmyfolder.tar.gz
and it's generally suited for servers where you don't want to spend even a tiny bit of extra CPU if not necessary. For archiving I recommend 7z, it has a very good LZMA algorithm. And it's free/open source.gzip
, the main advantages are: 1. it is the standard of the internet, standard for digital_preservation and for many serious systems (e.g. Apache Hive default); 2. it can operate in pipes, in stream mode, with no disk-usage. 3. it is free, transparent, it is not a black-box, no risk of Trojans, etc. 4. the compression ratios and CPU usage are reasonable when compared with other generic compression algorithms.