Trước hết cần đảm bảo .NET 4.5 đã được cài đặt và add reference System.IO.Compression.FileSystem
- //nén thư mục TestZipFile thành TestZipFile.zip
- System.IO.Compression.ZipFile.CreateFromDirectory("C:\\Users\\Phong\\Desktop\\TestZipFile", "C:\\Users\\Phong\\Desktop\\TestZipFile.zip");
- //giải nén TestZipFile.zip ra thư mục TestExtract
- System.IO.Compression.ZipFile.ExtractToDirectory("C:\\Users\\Phong\\Desktop\\TestZipFile.zip", "C:\\Users\\Phong\\Desktop\\TestExtract");
Không có nhận xét nào :
Đăng nhận xét