locked
How to compress multiple files in a folder into a single Gzip file RRS feed

  • Question

  • Hi every one,

    I want to compress multiple .txt files into single GZIP file. Can any one help me out for sorting out this issue. I want to develop using C#.net 3.5 version.

     

    Thanks & Regards,

    Anil Kumar

    Thursday, October 31, 2013 7:00 AM

Answers

  • GZipStream works on single stream of data. If we try to zip whole Directory, we need to pass as a stream to compress. This may not be possible because directly, however if we try to compress directory with some logic say tar or zip  and then we can GZip the same. 

    Example: http://www.csharpest.net/?p=110 it uses opensource lib  SharpZipLib

    • Marked as answer by Eason_H Thursday, November 7, 2013 4:23 AM
    Thursday, October 31, 2013 11:16 AM

All replies

  • Thursday, October 31, 2013 8:49 AM
  • Dear Mahesh, 

     Thank you for responding, this function will compress the individual file in the directory into .gz file, but i what to compress all the files in the directory into single .gz file.

    Regards,

    Anil Kumar

    Thursday, October 31, 2013 9:13 AM
  • GZipStream works on single stream of data. If we try to zip whole Directory, we need to pass as a stream to compress. This may not be possible because directly, however if we try to compress directory with some logic say tar or zip  and then we can GZip the same. 

    Example: http://www.csharpest.net/?p=110 it uses opensource lib  SharpZipLib

    • Marked as answer by Eason_H Thursday, November 7, 2013 4:23 AM
    Thursday, October 31, 2013 11:16 AM
  • Thank you very much Mahesh.
    Wednesday, November 6, 2013 8:17 AM