string archivePath = "path/to/"; string extractPath = "path/to/extract/folder";
string[] filesRar = Directory.GetFiles(archivePath, "*.RAR"); foreach (var item in filesRar) { using (Stream stream = File.OpenRead(item)) { var reader = SharpCompress.Readers.ReaderFactory.Open(stream); while (reader.MoveToNextEntry()) { if (!reader.Entry.IsDirectory) { reader.WriteEntryToDirectory(extractPath); } } } }
标签:SharpCompress,stream,C#,解压缩,reader,filesRar,string From: https://www.cnblogs.com/LuoCore/p/17406396.html