我想要做的是将文件解压缩到现有目录中并覆盖旧文件(如果存在)。
我正在使用此命令解压缩文件:
ZipFile.ExtractToDirectory(path + file_name_zip, path);
使用ZipFileExtensions.ExtractToFile
Extracts an entry in the zip archive to a file, and optionally overwrites an existing file that has the same name.
foreach (ZipArchiveEntry entry in archive.Entries)
{
if (entry.FullName.EndsWith(".txt", StringComparison.OrdinalIgnoreCase))
{
entry.ExtractToFile(Path.Combine(extractPath, entry.FullName), true);
}
}