I search a code to compressed a folder in tar.gz archive format. I work on Linux with Boost.
Asked
Active
Viewed 2,167 times
0
-
@Praetorian Sorry to waste all these close votes, but that wasn't a correct duplicate. The OP's merely looking for code how to compress a folder to tar gz, not to find compressed folders in a directory. – πάντα ῥεῖ Jul 02 '15 at 15:57
-
Why not simply call `tar` using `system()`? – πάντα ῥεῖ Jul 02 '15 at 15:58
-
@πάνταῥεῖ Oops, you're right. Thanks for catching that. – Praetorian Jul 02 '15 at 15:59
-
Unfortunately i can't call system because i work on embedded system&that's not authorized the system() function – Gaetan Griffon Du Bellay Jul 02 '15 at 16:02
-
Then you need to find a library that does archiving. AFAIK, there's nothing in Boost that does that. Boost.Serialization can create compressed archives from data, but that's not the same as compressing an existing folder. – Praetorian Jul 02 '15 at 16:06
-
@GaetanGriffonDuBellay Lookup the [LZMA library](http://7-zip.org/). We're using it on an embedded system sucessfully. And please don't ask such off-topic questions in the future. – πάντα ῥεῖ Jul 02 '15 at 16:09
-
are you sure? I realy thinks boost can create some archives. – Gaetan Griffon Du Bellay Jul 02 '15 at 16:11
-
@GaetanGriffonDuBellay He already mentioned boost's serialization library. The doubt is about the input (an existing folder). – πάντα ῥεῖ Jul 02 '15 at 16:13
-
i have an existing folder with some files & i need to compress it on tar.gz format so yea, in input i search to send an existing folder. – Gaetan Griffon Du Bellay Jul 02 '15 at 16:19
1 Answers
2
Boost doesn't have support for tar/zip/... archives.
For that, the most comprehensive library I know is libarchive
, which is used by many reputable projects, and supports all of the above.
You would still us e.g. Boost Iostreams compression filters to arrive at a compressed tar in that case.

sehe
- 374,641
- 47
- 450
- 633