Search

Friday, January 24, 2014
0 comments

How to create zip or compressed folder using c# programming

5:33 AMFriday, January 24, 2014
In this example, we will show that a directory,which contains lots of file, converted into compressed folder. There are many steps for designing this algorithm, these are

Step-1 : Add 'System.IO.Compression.FileSystem' assembly into your project.
assembly exist into your windows directory

 (~/Windows/Microsoft.NET/assembly/GAC_MSIL/System.IO.Compression.FileSystem/(Your .NET Version)
 
How to create zip or compressed folder using c# programming

Step-2 : copy this code, paste into your source code

 using System.IO.Compression;
using System.IO;

namespace compressiondecompress
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string source = @"e:\web";
            string dest = @"e:\web.zip";
           

            ZipFile.CreateFromDirectory(source, dest);


           
        }
    }
}

Code generate the following output
How to create zip or compressed folder using c# programming

Protected by Copyscape Online Copyright Protection Software

0 comments :

Post a Comment

 
Toggle Footer
Top