Skip to content

Using GzipStream to zip up more then one file

Joe

Asked Dec 7, 2009, 7:30 AM EST2 answers
Share
LinkedInX
Most of the samples i been finding just relate to one file. What if I needed more then one file zip up.

C#
 TextWriter wr;
            
            for (int i = 0; i < 4; i++)
            {
                wr = File.CreateText(@"code\code" + i + ".txt");
                wr.WriteLine("This would be a Text File");
                wr.Flush();
                wr.Close();
                wr.Dispose();
            }
            //Zip up the files (counted 4 files total)
            try
            {
       
            }
            catch
            {
                // Couldn't compress.
            }

How could I zip up all 4 text files and put them in all one zip file.

Joe

2 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • 0
    Thanks. how ever that idea requires a Libary related to zipping files. The libary is a create idea. Just I didn't want to add that libary to this project. Thanks any way
    0