Files within a File

Arokh

Well-known member
Joined
Apr 11, 2006
Messages
124
I have about 6200 little files in a directory,
which might be used by my program but in most cases the file will only be used once.

Now having 6200 files of 2-10kb in a directory looks bad, so Im looking for another way:

One solution I thought of was creating a file which acts a an archive and contains all files.
I cant use zip compression because if I need to use one of the files,
I would like to get them as fast as possible without decompressing the whole archive first.

Is there an easy way to pull this off, or do I have to write something like that myself?
 
Do you need to compress the files? If not, it is as simple as writing all of the file data into a filestream with a small amount of header data to be used to find the offset of an embedded file.
 
You could use a zip file but specify zero compression, that way there is no performance hit due to compression / decompression.

Also if you are using zip compression each file is compressed individually, you would not need to decompress 6000+ files to get to a file near the end of the archive.
 
I didnt know that you could do that with zip, interesting.

Ive already done it like marble_eater suggested,
I guess I will change it to a ZIP archive sometime in the future.
 
Back
Top