Search This Blog

Saturday, October 15, 2011

Vb.net Code For Delete or Create New Folder

http://xldennis.wordpress.com/2010/08/09/working-with-folders/


Nice Link For All Folder Related Activity

Code snipt files links

http://kalit-codesnippetsofnettechnology.blogspot.com/2011/02/zip-file-or-folder-in-c.html

Good One .,

Code snipt files links

http://kalit-codesnippetsofnettechnology.blogspot.com/2011/02/zip-file-or-folder-in-c.html

Good One .,

How To zip All Files

http://codecruncher.blogsome.com/2007/01/04/37/


Code :

private static void CompressZip(string sPath)
{
ZipOutputStream zipOut = new ZipOutputStream(File.Create(@"C:\Temp\test.zip"));
foreach(string fName in Directory.GetFiles(sPath))
{
FileInfo fi = new FileInfo(fName);
ZipEntry entry = new ZipEntry(fi.Name);
FileStream sReader = File.OpenRead(fName);
byte[] buff = new byte[Convert.ToInt32(sReader.Length)];
sReader.Read(buff, 0, (int) sReader.Length);
entry.DateTime = fi.LastWriteTime;
entry.Size = sReader.Length;
sReader.Close();
zipOut.PutNextEntry(entry);
zipOut.Write(buff, 0, buff.Length);
}
zipOut.Finish();
zipOut.Close();
Console.WriteLine("Done!!");
}