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 Crawling Class - feedback wanted.

Directory Crawling Class - feedback wanted.

Scheduled Pinned Locked Moved C#
sysadminalgorithmsbeta-testingquestioncode-review
8 Posts 3 Posters 2 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.
  • G Offline
    G Offline
    GuyThiebaut
    wrote on last edited by
    #1

    I could do with some feedback on some development I am doing. I am writing a class to return file information within a directory. The class allows a recursive search of the directory - so the class will enable you to pull all the file information, for instance, from the C: drive or a mapped network drive. Originally I tried the System.IO.Directory class however I found that the GetFiles method fell over with exceptions on certain files (system files, etc...). The class I am writing threads the searching so that one can access file information as it is being found (searching C: can take a couple of minutes!). Have I gone to the trouble of creating a class for which there is already a solution? Regards Guy

    You always pass failure on the way to success.
    E S 2 Replies Last reply
    0
    • G GuyThiebaut

      I could do with some feedback on some development I am doing. I am writing a class to return file information within a directory. The class allows a recursive search of the directory - so the class will enable you to pull all the file information, for instance, from the C: drive or a mapped network drive. Originally I tried the System.IO.Directory class however I found that the GetFiles method fell over with exceptions on certain files (system files, etc...). The class I am writing threads the searching so that one can access file information as it is being found (searching C: can take a couple of minutes!). Have I gone to the trouble of creating a class for which there is already a solution? Regards Guy

      You always pass failure on the way to success.
      E Offline
      E Offline
      Ennis Ray Lynch Jr
      wrote on last edited by
      #2

      If the built in File and Directory classes are failing you then the native Windows API will surely have the answer.


      Need a C# Consultant? I'm available.
      Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

      G 1 Reply Last reply
      0
      • E Ennis Ray Lynch Jr

        If the built in File and Directory classes are failing you then the native Windows API will surely have the answer.


        Need a C# Consultant? I'm available.
        Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

        G Offline
        G Offline
        GuyThiebaut
        wrote on last edited by
        #3

        Thanks, I used Directory.GetFiles and Directory.GetDirectories class/methods to recurse through the directory structure. My question was more that this is such an common thing, getting file information recursively, that I was wondering if a class that could do this existed. Regards Guy

        You always pass failure on the way to success.
        E 1 Reply Last reply
        0
        • G GuyThiebaut

          Thanks, I used Directory.GetFiles and Directory.GetDirectories class/methods to recurse through the directory structure. My question was more that this is such an common thing, getting file information recursively, that I was wondering if a class that could do this existed. Regards Guy

          You always pass failure on the way to success.
          E Offline
          E Offline
          Ennis Ray Lynch Jr
          wrote on last edited by
          #4

          Have you looked into the DirectoryInfo class which has recursive methods?


          Need a C# Consultant? I'm available.
          Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

          G 2 Replies Last reply
          0
          • E Ennis Ray Lynch Jr

            Have you looked into the DirectoryInfo class which has recursive methods?


            Need a C# Consultant? I'm available.
            Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

            G Offline
            G Offline
            GuyThiebaut
            wrote on last edited by
            #5

            Thanks Ennis, I'll check it out. Regards Guy

            You always pass failure on the way to success.
            1 Reply Last reply
            0
            • E Ennis Ray Lynch Jr

              Have you looked into the DirectoryInfo class which has recursive methods?


              Need a C# Consultant? I'm available.
              Happiness in intelligent people is the rarest thing I know. -- Ernest Hemingway

              G Offline
              G Offline
              GuyThiebaut
              wrote on last edited by
              #6

              I found a good article at clickety. However in the end I think I got it right(for my purposes) - as I have found using recursion fills the stack up pretty quickly when recursing through a large directory structure. Thanks for your help, Guy

              You always pass failure on the way to success.
              1 Reply Last reply
              0
              • G GuyThiebaut

                I could do with some feedback on some development I am doing. I am writing a class to return file information within a directory. The class allows a recursive search of the directory - so the class will enable you to pull all the file information, for instance, from the C: drive or a mapped network drive. Originally I tried the System.IO.Directory class however I found that the GetFiles method fell over with exceptions on certain files (system files, etc...). The class I am writing threads the searching so that one can access file information as it is being found (searching C: can take a couple of minutes!). Have I gone to the trouble of creating a class for which there is already a solution? Regards Guy

                You always pass failure on the way to success.
                S Offline
                S Offline
                schoetbi
                wrote on last edited by
                #7

                Hi, well you can also handle that exception, or? try{ code where the exception occoures } catch (Exception e) { handle the exception, or just log it somewhere } regards, Tobias

                G 1 Reply Last reply
                0
                • S schoetbi

                  Hi, well you can also handle that exception, or? try{ code where the exception occoures } catch (Exception e) { handle the exception, or just log it somewhere } regards, Tobias

                  G Offline
                  G Offline
                  GuyThiebaut
                  wrote on last edited by
                  #8

                  Thanks Tobias, Yes I used this sort of exception handling with the class/methods I used. Regards Guy

                  You always pass failure on the way to success.
                  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