Reputation: 19
My objective is to compress a whole directory using LZ4. I have the code to compress a single file. So I iterated over directory and sub-directories and compressed every file with (.lz4) extension (Eg: filename.txt to filename.txt.lz4). The result I get is a directory containing the compressed files. But I want the output to be an archive file. I don't know which file extension the resultant folder should be archived (zip, tar). Also, how to do that in C++. Thanks in advance.
Upvotes: 0
Views: 1425
Reputation: 112642
You need to make a tar file, which is an uncompressed archive of your files and directories, and then compress that with lz4. libarchive can help with the tar part.
Upvotes: 2
Reputation: 13988
Try this command line :
tar cvf - directory | lz4 - archive.tar.lz4
Regeneration will be
lz4 archive.tar.lz4 - | tar xvf -
Upvotes: 0