Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Directory Parsing

Directory Parsing

Scheduled Pinned Locked Moved C#
helpdata-structuresregexjson
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sean_mufc
    wrote on last edited by
    #1

    Hello i'm having a problem with the following code fragment: //---------------------------------------------------------------------- //loop through each sub directory in the current dir //and look for each folders contained in folders array foreach(DirectoryInfo subDir in dirs) { //this line eliminates an IO error, although I dont know why it is an error if (subDir.ToString().Equals("System Volume Information")) Console.WriteLine(); else { for (int i =0; i < 7; i++) { currentFolder = folders[i]; if (subDir.Exists)//make sure directory exists { subDir.GetDirectories("*" + currentFolder + "*"); Console.WriteLine(subDir.ToString()); subDir.Equals(null); } //end if } //end for }//end else }//end foreach //recursive statements DirectoryInfo[] subDirs = dirInfo.GetDirectories(); for (int i = 0; i < subDirs.Length; i++) { String dirName = subDirs[i].FullName.ToString(); findFolders(dirName); } }//end method //--------------------------------------------------------------------- Basically it should search the directory hierarchy and ouput to the console the names of the directories that match search criteria contained in the array []folders. Problem is it returns the entire directory hierarchy!! CAN ANYONE HELP ME!!!!

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups