L
laura
I am writing an intranet and want to be able to hyperlink to all files
within a specific folder AND it's subfolders. Whilst I can hyperlink to the
files in the specified folder AND I can also iterate through the subfolders
and list them, for some reason I cannot hyperlink to the sub folders. I am
writing this software at home using a computer that has IIS and Windows 98
and am accessing this as my server from another computer on my network.
My Home Page on the Server is http://maxitek (the name of my Windows98
Computer) and when I look at the value of the variable "PathSpec" - it
becomes C:\Inetpub\wwwroot\ which when I try to create links to the sub
folder it is probably here where the problem is. The files themselves link,
but not with their full subfolder names, i.e., for a file called
"C:\Inetpub\wwwroot\mytest\mytest2\mytest.txt" I am getting a link that just
looks like this
http://maxitek/mytest.txt It just misses out the path
/mystest/mytest2/mytest.txt and therefore the hyperlink does not work.
Help appreciated, Thanks
Laura TD
My code looks like this.
The Hyperlink that calls the ASP file:
<a href="dircompliance.asp?PP=C:\Inetpub\wwwroot\&UU=//maxitek">Hyperlink to
all Files</a>
<%option explicit %>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Filing System Scan</TITLE>
</HEAD>
<BODY>
<%
Dim Path, objFso
Path = request.querystring("PP")
Response.Write("<br><font size = '2' face='arial, helvetica,
sans-serif'><b>All Files Located in: " & Path & "</b><p>")
Set objFso = CreateObject("Scripting.FileSystemObject")
%>
<font size = 2 face="arial, helvetica, sans-serif">
<% Call ScanFolders(Path) %>
</font>
<%
Function ScanFolders(PathSpec)
Dim fs, f, Folder, fc, s, File, FileList, FolderInfo, FileName, Name,
sUU, sPP, Datecreated, LastModified, fullname
%>
<BLOCKQUOTE>
<%
Response.Write("<b>Full Path =" & PathSpec & "</b>")
Set FolderInfo = objFso.GetFolder(PathSpec)
Set FileList = FolderInfo.Files
%>
<table width=80% border=0 cellspacing=0 cellpadding=0>
<TR>
<TD><font size="2" face="arial"><b>File Name</b></font></td>
<TD><font size="2" face="arial"><b>Created</b></font></td>
<TD><font size="2" face="arial"><b>Last modified</b></font></td>
</TR>
<%
For Each File in FileList
Name = Cstr(File.Name)
FileName = UCase(Name)
fullname = pathspec&name
Datecreated = File.DateCreated
Lastmodified = File.DateLastModified
%>
<TR>
<%
Response.Write("<td><font size='2'
face='arial'> <a href='" & Name &"'>" & Name
&"</a></font></td>")
Response.Write("<td><font size='2' face='arial'>" & Datecreated &
"</font></td>")
Response.Write("<td><font size='2' face='arial'>" & LastModified &
"</font></td>")
%>
</tr>
<%
Next
%>
</table>
</BLOCKQUOTE>
<%
Set f = objFso.GetFolder(PathSpec)
Set fc = f.SubFolders
For Each Folder in fc
%>
<BLOCKQUOTE>
<%
response.write("folder path " & f.path) ' just to show where I am
Call ScanFolders(PathSpec & Folder.Name & "\")
%>
</BLOCKQUOTE>
<%
Next
'Clean up!
Set FolderInfo = Nothing
Set FileList = Nothing
End Function
'Clean up!
Set objFso = Nothing
%>
</BODY>
</HTML>
within a specific folder AND it's subfolders. Whilst I can hyperlink to the
files in the specified folder AND I can also iterate through the subfolders
and list them, for some reason I cannot hyperlink to the sub folders. I am
writing this software at home using a computer that has IIS and Windows 98
and am accessing this as my server from another computer on my network.
My Home Page on the Server is http://maxitek (the name of my Windows98
Computer) and when I look at the value of the variable "PathSpec" - it
becomes C:\Inetpub\wwwroot\ which when I try to create links to the sub
folder it is probably here where the problem is. The files themselves link,
but not with their full subfolder names, i.e., for a file called
"C:\Inetpub\wwwroot\mytest\mytest2\mytest.txt" I am getting a link that just
looks like this
http://maxitek/mytest.txt It just misses out the path
/mystest/mytest2/mytest.txt and therefore the hyperlink does not work.
Help appreciated, Thanks
Laura TD
My code looks like this.
The Hyperlink that calls the ASP file:
<a href="dircompliance.asp?PP=C:\Inetpub\wwwroot\&UU=//maxitek">Hyperlink to
all Files</a>
<%option explicit %>
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>Filing System Scan</TITLE>
</HEAD>
<BODY>
<%
Dim Path, objFso
Path = request.querystring("PP")
Response.Write("<br><font size = '2' face='arial, helvetica,
sans-serif'><b>All Files Located in: " & Path & "</b><p>")
Set objFso = CreateObject("Scripting.FileSystemObject")
%>
<font size = 2 face="arial, helvetica, sans-serif">
<% Call ScanFolders(Path) %>
</font>
<%
Function ScanFolders(PathSpec)
Dim fs, f, Folder, fc, s, File, FileList, FolderInfo, FileName, Name,
sUU, sPP, Datecreated, LastModified, fullname
%>
<BLOCKQUOTE>
<%
Response.Write("<b>Full Path =" & PathSpec & "</b>")
Set FolderInfo = objFso.GetFolder(PathSpec)
Set FileList = FolderInfo.Files
%>
<table width=80% border=0 cellspacing=0 cellpadding=0>
<TR>
<TD><font size="2" face="arial"><b>File Name</b></font></td>
<TD><font size="2" face="arial"><b>Created</b></font></td>
<TD><font size="2" face="arial"><b>Last modified</b></font></td>
</TR>
<%
For Each File in FileList
Name = Cstr(File.Name)
FileName = UCase(Name)
fullname = pathspec&name
Datecreated = File.DateCreated
Lastmodified = File.DateLastModified
%>
<TR>
<%
Response.Write("<td><font size='2'
face='arial'> <a href='" & Name &"'>" & Name
&"</a></font></td>")
Response.Write("<td><font size='2' face='arial'>" & Datecreated &
"</font></td>")
Response.Write("<td><font size='2' face='arial'>" & LastModified &
"</font></td>")
%>
</tr>
<%
Next
%>
</table>
</BLOCKQUOTE>
<%
Set f = objFso.GetFolder(PathSpec)
Set fc = f.SubFolders
For Each Folder in fc
%>
<BLOCKQUOTE>
<%
response.write("folder path " & f.path) ' just to show where I am
Call ScanFolders(PathSpec & Folder.Name & "\")
%>
</BLOCKQUOTE>
<%
Next
'Clean up!
Set FolderInfo = Nothing
Set FileList = Nothing
End Function
'Clean up!
Set objFso = Nothing
%>
</BODY>
</HTML>