Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试将文本文件转换为 zip 文件。这是我的代码
zipFile.AddItem(@"D:\Inbox\GRN.txt")); zipFile.Save(Common.GetFileName(@"D:\Inbox\GRN.zip"));
从这里我可以压缩文件。但它的压缩完整路径。我想在 Grn 文件夹下只有 GRN.txt 应该可用。
但目前正在发生这样的事情 = GRN- Inbox-GRN.txt
请对此提供帮助。
您需要将第二个参数directoryPathInArchive作为string.empty. 所以试试这个
directoryPathInArchive
string.empty
zipFile.AddItem(@"D:\Inbox\GRN.txt","");