我使用 ZIpstorer 类库COM preSS文件。我可以通过调用 zip.AddFile
程序来压缩文件。但我想它有太多的子文件夹,以压缩文件夹。因此,所产生的压缩文件应具备的zip文件夹内和子文件夹结构正常。我不能做到这一点。如果我处理每个文件通过循环的所有文件夹和子文件夹,然后如果呼叫 zip.Addfile
然后它会导致与它里面的所有文件,没有目录结构zip文件。
I am using ZIpstorer class library to compress files. I am able to zip a file by calling zip.AddFile
procedure. But I want to zip folders which has subfolders too. So the resulting zip file should have folder and subfolder structure inside the zip file normally. I am not able to do it. if i process each file by looping all folders and sub folders and then if call zip.Addfile
then it will result in zip file with all the files inside it without a directory structure.
所以,我怎么可以压缩使用Zipstorer类的文件夹。我有什么样的变化怎么办?
So how can i zip a folder using Zipstorer class . What changes i have to do?
您可以使用(回)斜线为 _filenameInZip
(原文如此)参数目录中添加文件在压缩:
You can use (back)slashes for the _filenameInZip
(sic) parameter to add files in a directory in the zip:
zip.Addfile(,,"directory/filename.txt",);
或
zip.Addfile(,,"directory\\filename.txt",);