Using 7Zip command line tool you can Zip file or folders in server.
you can download 7Zip command line tool from
Here[
^]
check the sample code to zip a folder
protected void ZipFolder_Click()
{
ProcessStartInfo p = new ProcessStartInfo();
string sourceName = Server.MapPath("test");
string targetName = Guid.NewGuid().ToString();
p.FileName = Server.MapPath("7za.exe");
string ZipCommand = string.Format(@" a -tzip {0}.zip {1}\*", targetName, sourceName);
p.Arguments = ZipCommand;
p.WindowStyle = ProcessWindowStyle.Hidden;
p.UseShellExecute = false;
Process x = Process.Start(p);
String errmsg = "";
while (!x.StandardOutput.EndOfStream)
{
errmsg += x.StandardOutput.ReadLine() + "<br />" + Environment.NewLine;
}
Response.Write(errmsg);
x.WaitForExit();
}
if you want to know more check
7-Zip Command-Line Examples[
^]
.NET 7-Zip Executable Tutorial[
^]