Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7953379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T03:08:41+00:00 2026-06-04T03:08:41+00:00

I’m trying to extract an ISO to a folder with the same name without

  • 0

I’m trying to extract an ISO to a folder with the same name without .iso on the end.

I’m having a problem with winrar as it will not start the extract when I start up with the seach starting in the folder with the ISO.

UPDATED with answer code

private void ExtractISO(string toExtract, string folderName)
    {
        // reads the ISO
        CDReader Reader = new CDReader(File.Open(toExtract, FileMode.Open), true);
        // passes the root directory the folder name and the folder to extract
        ExtractDirectory(Reader.Root, folderName /*+ Path.GetFileNameWithoutExtension(toExtract)*/ + "\\", "");
        // clears reader and frees memory
        Reader.Dispose();
    }

    private void ExtractDirectory(DiscDirectoryInfo Dinfo, string RootPath, string PathinISO)
    {
        if (!string.IsNullOrWhiteSpace(PathinISO))
        {
            PathinISO += "\\" + Dinfo.Name;
        }
        RootPath += "\\" + Dinfo.Name;
        AppendDirectory(RootPath);
        foreach (DiscDirectoryInfo dinfo in Dinfo.GetDirectories())
        {
            ExtractDirectory(dinfo, RootPath, PathinISO);
        }
        foreach (DiscFileInfo finfo in Dinfo.GetFiles())
        {
            using (Stream FileStr = finfo.OpenRead())
            {
                using (FileStream Fs = File.Create(RootPath + "\\" + finfo.Name)) // Here you can Set the BufferSize Also e.g. File.Create(RootPath + "\\" + finfo.Name, 4 * 1024)
                {
                    FileStr.CopyTo(Fs, 4 * 1024); // Buffer Size is 4 * 1024 but you can modify it in your code as per your need
                }
            }
        }
    }

    static void AppendDirectory(string path)
    {
        try
        {
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
        }
        catch (DirectoryNotFoundException Ex)
        {
            AppendDirectory(Path.GetDirectoryName(path));
        }
        catch (PathTooLongException Ex)
        {
            AppendDirectory(Path.GetDirectoryName(path));
        }
    }

The user selects the folder to extract (.ISO) toExtract. I then use it in the Process.Start() in the background worker. That just seems to open the mounting software and doesn’t extract the ISO to the desired folder name.

Thanks in advance for your help.

Or if anyone could give me a batch to extract the ISO instead and to call it from c# passing toExtract and the folder name that would be helpful too.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T03:08:42+00:00Added an answer on June 4, 2026 at 3:08 am

    If external Class Libraries are OK!

    Then use SevenZipSharp or .NET DiscUtils to extract ISO’s…

    These two ClassLibraries can manage ISO and Extract them!

    For DiscUtils you can find some codes for ISO Management [CDReader Class] at the Link I provided.

    But For SevenZipSharp, Please Explore the ClassLibrary source and find the Code to Extract or Google to find it!

    To get the Name of the folder just use Path.GetFileNameWithoutExtension((string)ISOFileName) which will return "ISOFile" for an iso named "ISOFile.iso". And then you can use it with your desired path.

    UPDATE

    Code To Extract ISO Image with DiscUtils :

    using DiscUtils;
    using DiscUtils.Iso9660;
    
    void ExtractISO(string ISOName, string ExtractionPath)
    {
        using (FileStream ISOStream = File.Open(ISOName, FileMode.Open))
        {
            CDReader Reader = new CDReader(ISOStream, true, true);
            ExtractDirectory(Reader.Root, ExtractionPath + Path.GetFileNameWithoutExtension(ISOName) + "\\", "");
            Reader.Dispose();
        }
    }
    void ExtractDirectory(DiscDirectoryInfo Dinfo, string RootPath, string PathinISO)
    {
        if (!string.IsNullOrWhiteSpace(PathinISO))
        {
            PathinISO += "\\" + Dinfo.Name;
        }
        RootPath += "\\" + Dinfo.Name;
        AppendDirectory(RootPath);
        foreach (DiscDirectoryInfo dinfo in Dinfo.GetDirectories())
        {
            ExtractDirectory(dinfo, RootPath, PathinISO);
        }
        foreach (DiscFileInfo finfo in Dinfo.GetFiles())
        {
                using (Stream FileStr = finfo.OpenRead())
                {
                    using (FileStream Fs = File.Create(RootPath + "\\" + finfo.Name)) // Here you can Set the BufferSize Also e.g. File.Create(RootPath + "\\" + finfo.Name, 4 * 1024)
                    {
                        FileStr.CopyTo(Fs, 4 * 1024); // Buffer Size is 4 * 1024 but you can modify it in your code as per your need
                    }
                }
        }
    }
    static void AppendDirectory(string path)
    {
        try
        {
            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
        }
        catch (DirectoryNotFoundException Ex)
        {
            AppendDirectory(Path.GetDirectoryName(path));
        }
        catch (PathTooLongException Exx)
        {
            AppendDirectory(Path.GetDirectoryName(path));
        }
    }
    

    Use It with Like This :

    ExtractISO(ISOFileName, Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory) + "\\");
    

    Working! Tested By Me!

    And Of Course You can always add more Optimization to the code…

    This Code is Just a Basic One!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I need a function that will clean a strings' special characters. I do NOT
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Specifically, suppose I start with the string string =hello \'i am \' me And
I am trying to render a haml file in a javascript response like so:
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.