Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_web_howto thread: Path to a file


Message #1 by "Mark Collins" <mark.collins@c...> on Thu, 22 Feb 2001 17:14:11
lets say i have a file called 'myfile.asp'



it is located in the directory:



c:\inetpub\wwwroot\thisdir\thatdir\anotherdir\so_on\further\yougetthemessag

e



this is a long directory. Lets say I dont know the directory, but I just 

have the filename, and i'm in the current directory of the file.



Can anybody tell me how to locate the path to a file in any directory?



<%



'I'm in the c:\inetpub\wwwroot\temp directory with a file called blank.asp

'the code below does not work, but I have no idea how to write a function 

to

'do the above method



set fsys = createobject("scripting.filesystemobject")



response.write "file is in " & fsys.path("blank.asp")

%>



can anybody help me,



thanks



mark.
Message #2 by "Wally Burfine" <oopconsultant@h...> on Thu, 22 Feb 2001 19:10:51 -0000
If you know the path in relation to where you are, then the following will 

work:



Server.Mappath("../thisdir\thatdir\anotherdir\so_on\further\yougetthemessag

")



If this is what you are thinking. If you don't know the path, but know that 

it is on the same machine, you can use the fileSystemObject to recurse 

through all the paths on the machine to find it.



Regards,

Wally

Message #3 by "Drew, Ron" <RDrew@B...> on Thu, 22 Feb 2001 14:51:56 -0500
This message is in MIME format. Since your mail reader does not understand

this format, some or all of this message may not be legible.



------_=_NextPart_001_01C09D08.E97768B0

Content-Type: text/plain



I use this....just change the name mergeguest.asp....

.................................................

<%@ Language=VBScript %>



<HTML>

<HEAD>

<title>MapPath</title>

</HEAD>

<BODY>

<% 

  Response.Write(Server.MapPath("mergeguest.asp"))

%>



</BODY>

</HTML>

....................................................

-----Original Message-----

From: Mark Collins [mailto:mark.collins@c...]

Sent: Thursday, February 22, 2001 12:14 PM

To: ASP Web HowTo

Subject: [asp_web_howto] Path to a file





lets say i have a file called 'myfile.asp'



it is located in the directory:



c:\inetpub\wwwroot\thisdir\thatdir\anotherdir\so_on\further\yougetthemessag

e



this is a long directory. Lets say I dont know the directory, but I just 

have the filename, and i'm in the current directory of the file.



Can anybody tell me how to locate the path to a file in any directory?



<%



'I'm in the c:\inetpub\wwwroot\temp directory with a file called blank.asp

'the code below does not work, but I have no idea how to write a function 

to

'do the above method



set fsys = createobject("scripting.filesystemobject")



response.write "file is in " & fsys.path("blank.asp")

%>



can anybody help me,



thanks



mark.




$subst('Email.Unsub')




Message #4 by "Alex Shiell, ITS, EC, SE" <alex.shiell@s...> on Fri, 23 Feb 2001 10:11:51 -0000
use server.mappath() to ascertain your current physical path



-----Original Message-----

From: Mark Collins [mailto:mark.collins@c...]

Sent: Thursday, February 22, 2001 5:14 PM

To: ASP Web HowTo

Subject: [asp_web_howto] Path to a file





lets say i have a file called 'myfile.asp'



it is located in the directory:



c:\inetpub\wwwroot\thisdir\thatdir\anotherdir\so_on\further\yougetthemessag

e



this is a long directory. Lets say I dont know the directory, but I just 

have the filename, and i'm in the current directory of the file.



Can anybody tell me how to locate the path to a file in any directory?



<%



'I'm in the c:\inetpub\wwwroot\temp directory with a file called blank.asp

'the code below does not work, but I have no idea how to write a function 

to

'do the above method



set fsys = createobject("scripting.filesystemobject")



response.write "file is in " & fsys.path("blank.asp")

%>



can anybody help me,



thanks



mark.

________________________________________________________________________

Scottish Enterprise Network

http://www.scottish-enterprise.com


  Return to Index