我從來沒有這樣做過,但我正在開發一個簡單的應用程序,真的需要一些幫助。使用C#壓縮文件Winrar
這種情況是,我有一些excel文件都是名稱編碼的,我需要得到每個文件的前5個字母並將它們壓縮在一起。防爆。
MARKS MARKS 2 MARKS 3
這些所有壓縮。
是他們的任何方法來做到這一點,並壓縮與winrar。
感謝
我從來沒有這樣做過,但我正在開發一個簡單的應用程序,真的需要一些幫助。使用C#壓縮文件Winrar
這種情況是,我有一些excel文件都是名稱編碼的,我需要得到每個文件的前5個字母並將它們壓縮在一起。防爆。
MARKS MARKS 2 MARKS 3
這些所有壓縮。
是他們的任何方法來做到這一點,並壓縮與winrar。
感謝
我同意IonicZip(現在的dotnetzip)很好。這裏是你想要做的樣品
string somepath = "D:\\ExcelFiles";
string zippath = "D:\\ExcelFiles\\some.zip";
string[] filenames =
System.IO.Directory.GetFiles(somepath, "Mark*.xlsx", SearchOption.AllDirectories);
using (ZipFile zip = new ZipFile())
{
foreach (String filename in filenames)
{
ZipEntry e = zip.AddFile(filename, "");
}
zip.Save(zippath);
}
我在項目中使用Ionic Zip。 API調用非常簡單。你可以簡單地壓縮你的文件。
using (ZipFile zip = new ZipFile())
{
// add this map file into the "images" directory in the zip archive
zip.AddFile(@"C:\Users\kth\Desktop\dll\MARKS.xl", "images");
zip.Save("MyZipFile.zip");
}
謝謝幫助很多 –