.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

how to zip and unzip a folder

Posted By: jyothi     Posted Date: October 22, 2010    Points:2   Category :C#
hi

how to zip and unzip a folder using c#.net

Responses
Author: Sajid P K             
Posted Date: October 22, 2010     Points: 5   

Jyothi,

Reference Microsoft Shell Controls And Automation on the COM tab.

using Shell32;

public void CompressFolder(string CompressedFileName, string FolderToCompress)

{

byte[] B = new byte[22];

B[0] = 80;

B[1] = 75;

B[2] = 5;

B[3] = 6;

File.WriteAllBytes(CompressedFileName, B); //Make an empty PKZip file.

Shell SH = new Shell();

Folder SF = SH.NameSpace(CompressedFileName);

Folder DF = SH.NameSpace(FolderToCompress);

SF.CopyHere(DF,0);

}

public void ExpandFolder(string CompressedFileName, string ExpandedFolder)

{

Shell Sh = new Shell();

Folder SF = Sh.NameSpace(CompressedFileName);

Folder DF = Sh.NameSpace(ExpandedFolder);

foreach (FolderItem F in SF.Items()) DF.CopyHere(F,0);

}


More refer following

http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/b5bde5fa-f63a-41e0-8569-c75d2f61e76b

Regards,
Sajid P K

Author: Santosh             
Posted Date: October 25, 2010     Points: 5   

hi
Follow the below link...

http://www.emailarchitect.net/eacompression/sdk/html/object_overwrite.htm


Regards
Santosh



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend