2

Any idea how I can do this? I am able to compress a single file.

İsmet Alkan
  • 5,361
  • 3
  • 41
  • 64
BreakHead
  • 10,480
  • 36
  • 112
  • 165
  • Most likely C#: [System.IO.Compression.GZipStream](http://msdn.microsoft.com/en-us/library/system.io.compression.gzipstream.aspx). – cdhowie Nov 22 '10 at 14:50

2 Answers2

3

You cannot GZip an entire folder directly, since GZip operates on a single stream of data. You will first have to turn the folder into such a stream.

One way to do this would be to create a Tar archive from the directory. This will give you a single stream to work on, and since the Tar format is not compressed, GZip will usually achieve good compression ratios on Tar files.

cdhowie
  • 158,093
  • 24
  • 286
  • 300
1

GZip doesn't support multiple files. They have to be combined in another container first like Tar. If you need full Zip support for C# use this library:

http://www.icsharpcode.net/opensource/sharpziplib/

Samuel Neff
  • 73,278
  • 17
  • 138
  • 182