SharpCompress 解压文件保留目录结构

public void ExtractArchive(Stream stream, string destinationPath)
{
    using (var reader = ReaderFactory.Open(stream))
    {
        while (reader.MoveToNextEntry())
        {
            if (!reader.Entry.IsDirectory)
            {
                reader.WriteEntryToDirectory(destinationPath, new ExtractionOptions() { ExtractFullPath = true, Overwrite = true });
            }
        }
    }
}
posted @ 2024-03-26 15:35  暖暖De幸福  阅读(41)  评论(0编辑  收藏  举报