Finding a File

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?QXJuZSBCZXJ1bGRzZW4=?=

    #1

    Finding a File

    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
  • zacks@construction-imaging.com

    #2
    Re: Finding a File

    On Oct 2, 10:08 am, Arne Beruldsen
    <ArneBeruld...@ discussions.mic rosoft.comwrote :
    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.G etFiles and
    DirectoryInfo.G etDirectories. Take a look at the class I posted here:



    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.

    Comment

    • Lloyd Sheen

      #3
      Re: Finding a File


      <zacks@construc tion-imaging.comwrot e in message
      news:1191337582 .624040.177450@ g4g2000hsf.goog legroups.com...
      On Oct 2, 10:08 am, Arne Beruldsen
      <ArneBeruld...@ discussions.mic rosoft.comwrote :
      >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.G etFiles and
      DirectoryInfo.G etDirectories. Take a look at the class I posted here:
      >

      >
      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.
      >
      If you are using VB 2005 then in the namespace
      Microsoft.Visua lBasic.FileIO.F ileSystem 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

      Comment

      Working...