Click here to Skip to main content
15,891,136 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
String filename = @"" + textBox8.Text;
string ppath = @"" + System.IO.Path.GetDirectoryName(textBox8.Text) + "\\"System.IO.Path.GetFileNameWithoutExtension(textBox8.Text);
System.IO.Directory.CreateDirectory(@"" + ppath);
try
{
var archive = SharpCompress.Archives.Rar.RarArchive.Open(filename);
foreach (var entry in archive.Entries.Where(entry => !entry.IsDirectory))
{
entry.WriteToDirectory(ppath, new ExtractionOptions()
{
});
}
}catch(Exception ex)
{
textBox10.Text = Convert.ToString(ex);
}
}

What I have tried:

I have used a Nunrar,SevenZip Extractor and also many packages,Facing this same error,But that File Extracted in WinRar and 7zip also
Posted
Updated 13-Mar-18 1:30am
v2
Comments
Mehdi Gholam 13-Mar-18 6:10am    
Your file may be corrupt.
Member 13018216 13-Mar-18 6:30am    
But that is Extracted in WinRar and 7zip properly

1 solution

When the archive can be unpacked with some tools (including the official one) but not by others, it might have been created with options that are not supported by all uncompressing libraries or it is in RAR 5.0 format which is not supported by all libraries (especially older ones).

You can check the header of the archive against the documentation:
RAR 5.0 archive format[^]

You might also ask the creator of the archive about the used tool and options.
 
Share this answer
 
Comments
Member 13018216 13-Mar-18 10:48am    
I compressed a format with Rar4 format,It will extract a files only not diectories now
Jochen Arndt 13-Mar-18 11:12am    
Might be a similar problem (library does not support directories) but RAR4 should support directories.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900