Reputation: 10387
I'd like to use brotli to compress a list of files and directories. I'm able to do this with zip running
zip -r archive.zip *
and I'm looking for a similar command with brotli. I've tried
tar -cf archive.gz * && \
brotli -n -q 11 -o archive.zip archive.gz
but after decompression the zip doesn't have the same structure than with zip.
Upvotes: 7
Views: 6682
Reputation: 1557
Either of these commands will work to create a brotli compressed tar file without an intermediate tar file:
tar
with the option --use-compress-program
tar -cvf test-output.tar.br --use-compress-program="brotli -Z" ./my_data_to_compress
brotli
tar --create --verbose ./my_data_to_compress | brotli --output=compressed_files.tar.br
Upvotes: 2
Reputation: 154623
Your second command is actually right. Brotli, like Gzip/Bzip2/etc can only compress a single file.
What you must do is first package all of your files in a tarball:
tar -cvf output.tar /path/to/dir
And then compress the resulting tarball with Brotli:
brotli -j -Z output.tar
Which should leave you with a output.tar.br
file (similar to *.tar.gz
gzipped tarballs).
Upvotes: 10
Reputation: 804
Have you tried Brotli-cli?
This comes with a lot of options to get files compressed using Brotli
Upvotes: 0