On Oct 2, 10:08 am, Arne Beruldsen
<ArneBeruld...@discussions.microsoft.com> wrote:
> What is the best way to find a file? I don't know the directory but the file
> is almost certainly on the c drive.
>
> Thanks
You can do a search by using the DirectoryInfo.GetFiles and
DirectoryInfo.GetDirectories. Take a look at the class I posted here:
http://groups.google.com/group/microsoft.public.dotnet.languages.vb/browse_threa
d/thread/8bff5d662bc014bd/c6135c3c82347084?hl=en&lnk=gst&q=zacks&rnum=13#c6135c3
c82347084
Once you enumerate the root folder, you can then use a for/each loop
on the Files property to find the file. Just load a FileInfo object
with each file and then look at the Name property there to look for
the file you are looking for.
Lloyd Sheen - 02 Oct 2007 16:33 GMT
> On Oct 2, 10:08 am, Arne Beruldsen
> <ArneBeruld...@discussions.microsoft.com> wrote:
[quoted text clipped - 13 lines]
> with each file and then look at the Name property there to look for
> the file you are looking for.
If you are using VB 2005 then in the namespace
Microsoft.VisualBasic.FileIO.FileSystem there is a GetFiles function which
can search for files with wildcards and will do the recursive thing by using
a parameter in the function call.
Hope this helps
Lloyd Sheen