How do I create a VBScript to generate an HTML file listing of a directory 
Author Message
 How do I create a VBScript to generate an HTML file listing of a directory

Hi,
     I would like to write a VBScript that will read the contents of a
directory on the web server and generate an HTML file that contains URL
links to every file in the directory. The files will all be bitmaps and when
a user clicks on the link (created from the long filename) the user will see
the bitmap load in their browser. I've determined how to use the
FileSystemObject object with the GetFolder and Files properties to build a
list of the files. I have not figured out how to build the files from a
directory on the server nor have I figured out how to build the html file or
URL's. I am hosting my site on an NT4 Server SP6a with IIS4 installed. I
have little VBScript experience so if anyone can help I'd greatly appreciate
it.

Thanks,

John O'Neill Sr.
Rodeo Systems



Tue, 17 Dec 2002 03:00:00 GMT  
 How do I create a VBScript to generate an HTML file listing of a directory
<html>
<body style='font:10pt verdana;'>
<%
  set fso = createobject("scripting.filesystemobject")
  path = "./"
  realpath = server.mappath(path) & "\"
  response.write "Contents of """ & realpath & """<hr>"
  set folder = fso.getfolder(realpath)
  for each file in folder.files
    response.write _
      "<a href='" & path & file.name & "'>" _
    & file.name _
    & "</a><br>"
  next
%>
</body>
</html>

--
Michael Harris
MVP Scripting


Hi,
     I would like to write a VBScript that will read the contents of a
directory on the web server and generate an HTML file that contains URL
links to every file in the directory. The files will all be bitmaps and when
a user clicks on the link (created from the long filename) the user will see
the bitmap load in their browser. I've determined how to use the
FileSystemObject object with the GetFolder and Files properties to build a
list of the files. I have not figured out how to build the files from a
directory on the server nor have I figured out how to build the html file or
URL's. I am hosting my site on an NT4 Server SP6a with IIS4 installed. I
have little VBScript experience so if anyone can help I'd greatly appreciate
it.

Thanks,

John O'Neill Sr.
Rodeo Systems



Tue, 17 Dec 2002 03:00:00 GMT  
 How do I create a VBScript to generate an HTML file listing of a directory
Thanks Michael!


Quote:
> <html>
> <body style='font:10pt verdana;'>
> <%
>   set fso = createobject("scripting.filesystemobject")
>   path = "./"
>   realpath = server.mappath(path) & "\"
>   response.write "Contents of """ & realpath & """<hr>"
>   set folder = fso.getfolder(realpath)
>   for each file in folder.files
>     response.write _
>       "<a href='" & path & file.name & "'>" _
>     & file.name _
>     & "</a><br>"
>   next
> %>
> </body>
> </html>

> --
> Michael Harris
> MVP Scripting



Tue, 17 Dec 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. create an html file form the listing of a directory

2. Creating a file list HTML - is it possible?

3. Tool for automatically generating html links for whole website directory tree

4. how to create a list of the folders within a directory

5. Directory Listing of files to include files in the subdirectories

6. Directory Listing of files to include files in the subdirectories

7. Find the files under the directory from a file list

8. Updated: Creating HTML listing of font samples

9. Selecting files in many directories, use of file list box

10. Using WIN32 API to generate PDF files from HTML

11. Generating and html file with VB5

12. Generate HTML File from Crystal Report 7.0

 

 
Powered by phpBB® Forum Software