Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
Hi everyone I have a lot of rar file.And also there are a lot of folders into this rar files.and I want to GETDIRECTORIES inside rar file and get name of all folder and again enter into folder but without extracting


What I have tried:

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Posted
Updated 14-Apr-16 21:36pm

1 solution

have you looked at API Examples · adamhathcock/sharpcompress Wiki · GitHub[^]

A Sample ...

C#
using (Stream stream = File.OpenRead(@"C:\Code\sharpcompress.rar"))
{
    var reader = ReaderFactory.Open(stream);
    while (reader.MoveToNextEntry())
    {
        if (!reader.Entry.IsDirectory)
        {
            Console.WriteLine(reader.Entry.Key);
            reader.WriteEntryToDirectory(@"C:\temp", ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
        }
    }
}


it proves that identifying directories in rar files is possible - doubtless there are other API's out there that may be able to help
 
Share this answer
 
Comments
Sakeb 15-Apr-16 3:40am    
reader.WriteEntryToDirectory(@"C:\temp", ExtractOptions.ExtractFullPath | ExtractOptions.Overwrite);
i dont wnat to exrtact anything
Garth J Lancaster 15-Apr-16 3:57am    
so take that bit out - what, you expect that people do everything for you ? - that example was cut verbatim from his site to prove that directories could be identified
Sakeb 15-Apr-16 4:00am    
I cannot understand you

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