I'm working on a project that needed to unzip file and store in a specific folder. But the problem is, I don't know how to do it. It is my first time to work on this kind of project.
I'm using visual studio 2010. And I'm not gonna use any third party applications.
Can anyone suggest how could I do this?
i've tried this code but the ZIPFILE is not recognizable. It has a red line on it.
using System;
using System.IO;
using System.IO.Compression;
namespace UnzipFile
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void btnZip_Click(object sender, RoutedEventArgs e)
{
string startPath = @"c:\example\start";
string zipPath = @"c:\example\result.zip";
string extractPath = @"c:\example\extract";
ZipFile.CreateFromDirectory(startPath, zipPath);
ZipFile.ExtractToDirectory(zipPath, extractPath);
}
}
}