IRDump IRDump

IRDump IRDump

  • NA
  • 3
  • 5.6k

Illegal characters in path exception

Jun 4 2011 9:08 AM

Hello everybody
I have wrote a recursive function in VS2008 with C# Language to scan All folders in a Specific drive.
i used System.Io Functions .

it's here:

        private void scan(string DriveName)
        {
            string[] Directories = Directory.GetDirectories(DriveName);
            foreach (string foldername in Directories)
            {
                scan(foldername);                // recursive call
                listBox1.Items.Add(foldername);  // Add Everything To My List
            }
        }


but there is a problem .when i scan a cd contained a folder with invalid name like "$#%$#^|b a b a k %&%&#$#@||" , It encounter problem and scan failed .The message is  "Illegal characters in path exception" but I can do that scan  by vb6 useing COM Dlls .how can i solve it and  scan All file and Folders with illegal names by useing dot net framework classes & functions !

send me your idea please : [email protected]
thank you very much in advanced.
Regards


Answers (4)