2
Answers

Using GzipStream to zip up more then one file

Joe

Joe

15y
5.7k
1
Most of the samples i been finding just relate to one file. What if I needed more then one file zip up.

 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

Answers (2)