I have a directory that contains several files. I want compress this folder to a zip or tar.gz file. How can I do his work in C#?
GZip is part of Microsoft Framework 2.0 onward. Its called GZipStream under System.IO.Compression namespace.
To compress a directory with this class, you'd have to create a serializable class (for e.g. Directory) which contains a collection of Files.
The Files class would contain file-name and file-stream to read bytes from file. Once you do apply GZip on the Directory, it'll read Files one by one and write them to GZipStream.
Check this link: http://www.vwd-cms.com/forum/forums.aspx?topic=18