In article <bo**********@p rometheus.acsu. buffalo.edu>, rg27
@cse.buffalo.ed u enlightened us with...
Thank you for your reply. I am using Windows 2000 and IE6. The script is
to be run on my machine. As an example say I have a file called
display.html on my hard drive. When I load that file into the
browser(using file:// in the address bar) I want to see a list of files
which match a pattern (say beginning with abc) in the directory in which
display.html resides. This directory is local. So basically I want the
script to interact with the local filesystem and do some filename matching.
Oh, okay. Nope, not javascript. WSH (windows script host).
Try this. Worked fine for me - IE6/Win2KPro.
Set the folder to the one you want (i have wwwroot).
If that works for you, you can modify it to do pattern matching and
stuff. Look up WSH resources, as this is a javascript group. :)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
"http://www.w3.org/TR/REC-html40/loose.dtd">
<html>
<head>
<title> New Document </title>
</head>
<body>
<script language="vbscr ipt">
'List Files in a particular Directory
Dim fs2, f2, s2, folderspec2, strFileName2
'Specify the path in which directory you want the list of files
folderspec2 = "c:\inetpub\www root"
Set fs2 = CreateObject("S cripting.FileSy stemObject")
Set f2 = fs2.GetFolder(f olderspec2)
For Each FileName In f2.files
s2 = s2 & fileName.name
s2 = s2 & "<br>"
Next
'Close all objects, set to nothing to free up memory.
Document.Write s2
set f2 = nothing
set fs2 = nothing
</script>
</body>
</html>
--
-------------------------------------------------
~kaeli~
Jesus saves, Allah protects, and Cthulhu
thinks you'd make a nice sandwich.
http://www.ipwebdesign.net/wildAtHeart http://www.ipwebdesign.net/kaelisSpace
-------------------------------------------------