Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are ways to compress directory into single file

Don't know how to ask it so I will explain situation.

I need to store a few compressed files. The original idea was to create a folder and store as many compressed files as were needed and also create a file that holds data about every compressed file.

However, I was not allowed to create many files and must only have one. I decided to create a compressed file which has a header about further data and after header keep compressed data. But this option has disadvantages, e.g. editing such file after it is created takes long time because it must be fully rewritten even if I want to add one more little file.

So, as I imagine, I need to create folder with some specific attributes and create as many files inside. Is this even possible?

I'm creating an app for Windows, so I can use any stuff that works on Windows, and I'm coding with C++.

NOTE: A single file is needed because, for example, it will be sent through e-mail and attaching many files is not an ideal solution.

NOTE: I don't need an algorithm for compression, I need some way to efficiently store everything in single file.

like image 218
ST3 Avatar asked Aug 20 '13 09:08

ST3


1 Answers

You could create a SQLite database, or a SQL Server Compact Edition database (which resides in a single .sdf file), and store all your data in there as BLOBs. The database management system should be easy enough to deploy along with the other binaries of your application.

In the case of SQL Server Compact, I am not exactly sure how easy this is to use from unmanaged code (C++). It would be easy enough in .NET, but I'm quite sure it could be done for C++, too &mdash would take some research, though.

At least, this Stack Overflow question goes into how to connect to such a database from C++ through an OLE DB provider.

like image 197
stakx - no longer contributing Avatar answered Oct 15 '22 11:10

stakx - no longer contributing