<% @Page Language= "C#" %><% @Import Namespace="System.IO" %><% @Import Namespace="System.Text" %><% @Import Namespace="ICSharpCode.SharpZipLib.Zip" %><% @Import Namespace="ICSharpCode.SharpZipLib.Checksums" %><% @Import Namespace="ICSharpCode.SharpZipLib.GZip" %><HTML><HEAD><TITLE>Backup</TITLE></HEAD><BODY><script runat="server" language="C#">static string username = "tanonev";static string rootPath = "C:\\MemberSites\\" + username;static int offset = rootPath.Length + 1;class MyZip { public static void zipDir(string directory, ref Crc32 crc, ref ZipOutputStream s) { string[] filenames = Directory.GetFiles(directory); foreach (string file in filenames) { if (file.Substring(file.Length - 4) == ".zip") continue; FileStream fs = File.OpenRead(file); byte[] buffer = new byte[fs.Length]; fs.Read(buffer, 0, buffer.Length); ZipEntry entry = new ZipEntry(file.Substring(offset)); entry.DateTime = DateTime.Now; entry.Size = fs.Length; fs.Close(); crc.Reset(); crc.Update(buffer); entry.Crc = crc.Value; s.PutNextEntry(entry); s.Write(buffer, 0, buffer.Length); } string[] dirnames = Directory.GetDirectories(directory); foreach (string dir in dirnames) { zipDir(dir, ref crc, ref s); } } }void Page_Load() { Crc32 crc = new Crc32(); ZipOutputStream s = new ZipOutputStream(File.Create(rootPath + "\\webroot\\backup.zip")); s.SetLevel(5); MyZip.zipDir(rootPath, ref crc, ref s); s.Finish(); s.Close();}</script>All files have been zipped to backup.zip, in your webroot directory.</BODY></HTML>