Directory Crawling Class - feedback wanted.
-
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 theGetFiles
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 GuyYou always pass failure on the way to success.
-
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 theGetFiles
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 GuyYou always pass failure on the way to success.
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 -
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 HemingwayThanks, I used
Directory.GetFiles
andDirectory.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 GuyYou always pass failure on the way to success.
-
Thanks, I used
Directory.GetFiles
andDirectory.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 GuyYou always pass failure on the way to success.
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 -
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 HemingwayThanks Ennis, I'll check it out. Regards Guy
You always pass failure on the way to success.
-
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 HemingwayI 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.
-
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 theGetFiles
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 GuyYou always pass failure on the way to success.
-
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, TobiasThanks 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.