|
FileObjects Part 2 by Charles
Carroll
The file object is in newer versions of VBScript. Here we use
it to walk a directory and make links.
filename=/learn/test/fileobjectslinks.asp
<html><head>
<title>fileobjectslinks.asp</title>
</head><body>
<%
dirtowalk="/learn/test"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(server.mappath(dirtowalk))
Set fc = f.Files
For Each whatever in fc
response.write "<A HREF='"
response.write whatever.name
response.write "'>"
response.write whatever.name
response.write "</A><br>"
Next
%>
</body></html>
Now we will display graphics in a directory.
filename=/learn/test/fileobjectsgraphics.asp
<html><head>
<title>fileobjectsgraphics.asp</title>
</head><body>
<%
dirtowalk="/images"
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFolder(server.mappath(dirtowalk))
Set fc = f.Files
For Each whatever in fc
response.write "<IMG SRC='/images/"
response.write whatever.name
response.write "'>"
response.write whatever.name & "<br>"
Next
%>
</body></html>
 |  |  |
 |
There are many worthy charities!!. But perhaps help starving children in Africa or South America AND help Charles too.
a $5 tip buys him lunch at McDonalds,
a $20 tip buys his kid Hitoshi a new computer game,
a $39 tip buys his daughter Michiko a few nice outfits.
See our donor list.
|  |
 |  |  |
|
|
|
|