2016-01-22 38 views

回答

1

不知道這只是創建一個新的空zip文件。

  string[] filePaths = Directory.GetFiles(item.Path, "*", SearchOption.TopDirectoryOnly); 

      using (ZipArchive zip = ZipFile.Open(item.Path2, ZipArchiveMode.Create)) 
      { 
       foreach (string filePath in filePaths) 
       { 
        zip.CreateEntryFromFile(filePath, Path.GetFileName(filePath)); 
       } 
      }