Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / October 2007

Tip: Looking for answers? Try searching our database.

Finding a File

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Arne Beruldsen - 02 Oct 2007 15:08 GMT
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 - 02 Oct 2007 16:06 GMT
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

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.