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#?
Look into using SharpZipLib. It supports both GZip and ZIP compression in C#.
There is an excellent tutorial here outlining what you need to do to zip a directory with SharpZipLib.