Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to get the directory of a specific filename?

Status
Not open for further replies.
Nov 5, 2004
27
0
0
PH
Good Day to everyone,
I am new in ASP.net using vb.net.I just want to know if
there is a code where I can only input my filename and it will return it's corresponding directory.For example

dim a as string
a="temp.doc"
then what will i do to display its corresponding directory?
I formerly done that when i was still using vb 6 and it goes something like this.

dim a as string
dim b as string
a="temp.doc"
b=dir(a)
where b displays the path of this file.
I don't what is the corresponding code here in ASP.net and VB.net windows application.Please help me.


 
How is your application supposed to know what directory the file is in? There could be that file name in every directory you have - then what?

Are you trying to perhaps find the path to your application's EXE?

 
I am trying to point out that i am searching for a file that has no duplicate in other directories.for example a temp.doc which is unique.i don't know what code will i do to get its corresponding directory.
 
Take a look at the System.IO name space. I'm not sure if there is a search tool in there, but if not, you could pretty easily build a recursive director searcher that went looking for your file. Recursive directory code has been posted here a few times. There may even be a FAQ on it.

-Rick

VB.Net Forum forum796 forum855 ASP.NET Forum
[monkey]I believe in killer coding ninja monkeys.[monkey]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top