CL1 webserver: <Anantsystems<Ad info>

    AspnetEmail.com   AspNetPro.com

related sites: <FREE Help> <ASP> <Asp.net> <worldwide>  
feedback: <lovethat> <hatethat> <thanks> <credits> <contact us>

 PrintView CL1

       

FileObjects Part 4 by "Tim Foster"tfoster@pdxinc.com

The file object examples was modified by one of our readers to support folders and clicking on them to see the contents beneath. Our readers always come up with some nice variations and new examples.

<Test Script Below>

<html><head>
<title>fileobjectsplusdir.asp</title>
</head><body>
<%
additional = request.querystring("pathh")
folderspec = "/learn/"

if  additional & "x" <> "x" then
   additional = additional & "/"
   folderspec = folderspec & additional
end if

Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(server.mappath(folderspec))
Set fd = f.subfolders

response.write "<h2>FOLDERS</h2><blockquote>"
For Each whatever in fd
      response.write "<A HREF='"
       response.write request.servervariables("script_name")
       response.write "?pathh=" & whatever.name
       response.write "'>"
       response.write whatever.name & " - " & whatever.datecreated
       response.write "</A><br>"
Next

response.write "</blockquote><hr>"

   
response.write "<h2>FILES</h2><blockquote>"

Set fc = f.files

For Each whatever in fc
      response.write "<A HREF='"
       response.write folderspec & whatever.name
       response.write "'>"
       response.write whatever.name & " - " & whatever.datecreated
       response.write "</A><br>"
Next

response.write "</blockquote><hr>"


%>

</body></html>

 PrintView

CL1 webserver: <Anantsystems<Ad info>

    AspnetEmail.com   AspNetPro.com

related sites: <FREE Help> <ASP> <Asp.net> <worldwide>  
feedback: <lovethat> <hatethat> <thanks> <credits> <contact us>