which framework object searches folders/files for name match?

M

mp

in vb6 i've been using a very nice class for fast file gathering - collects
matching names, filetimes etc.
(I'm considering converting a working vb6 app to c# just for learning
process.)

in dotnet what would be the managed way to gather list of filenames/file
info for target criteria?

CFileSearch can take args for starting directory name, levels of subdirs to
check, matching filenames etc - very handy

'* CFileSearch
'* (c) 2004, 2005, 2006 Ulrich Korndörfer proSource software
development
'* www.prosource.de
'* German site with VB articles (in english) and code (comments in
english)
'* A class for scanning directories and searching files whose name matches
given criteria.

thanks for any pointers
mark
 
M

mp

Peter Duniho said:
mp said:
in vb6 i've been using a very nice class for fast file gathering -
collects matching names, filetimes etc.
(I'm considering converting a working vb6 app to c# just for learning
process.)

in dotnet what would be the managed way to gather list of filenames/file
info for target criteria? [...]

I don't think that there's a .NET class that does that per se. Note that
your "CFileSearch" class isn't really part of VB6 either. It's a
third-party utility.

However, you could easily build such a utility yourself using the
System.IO.File and System.IO.Directory classes, or the related FileInfo
and DirectoryInfo classes (actually, for what it sounds like you're
looking to do, I think the .Info classes are probably better, assuming
you're going to support searches that allow multiple criteria).

If and when you implement that, you could even share it with the community
as Ulrich Korndörfer did with his CFileSearch utility.

Pete

ok, I was optimistically thinking that so much of what previously
had to be 'roll your own' in the past was now included in the Framework
that this common (?maybe not?) need might be also.
I'll see what I can come up with but my chops are nothing like Ulrich's etal
so doubt if what I make would be worth sharing, but hey, thanks for the
undeserved compliment
:)
mark
 
M

mp

mp said:
Peter Duniho said:
mp said:
in vb6 i've been using a very nice class for fast file gathering -
collects matching names, filetimes etc.
(I'm considering converting a working vb6 app to c# just for learning
process.)

in dotnet what would be the managed way to gather list of filenames/file
info for target criteria? [...]

I don't think that there's a .NET class that does that per se. Note that
your "CFileSearch" class isn't really part of VB6 either. It's a
third-party utility.

However, you could easily build such a utility yourself using the
System.IO.File and System.IO.Directory classes, or the related FileInfo
and DirectoryInfo classes (actually, for what it sounds like you're
looking to do, I think the .Info classes are probably better, assuming
you're going to support searches that allow multiple criteria).

If and when you implement that, you could even share it with the
community as Ulrich Korndörfer did with his CFileSearch utility.

Pete

ok, I was optimistically thinking that so much of what previously
had to be 'roll your own' in the past was now included in the Framework
that this common (?maybe not?) need might be also.
I'll see what I can come up with but my chops are nothing like Ulrich's
etal
so doubt if what I make would be worth sharing, but hey, thanks for the
undeserved compliment
:)
mark

so would I use a Class Library type project to try to create that class?
If I just want to create a class that can be used in multiple applications
I wasn't sure if class Library project was something different than just a
single class for reuse.
thanks
mark
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top