Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Get Folder Names and Print to Screen

Status
Not open for further replies.

duckiebear

Programmer
May 25, 2004
32
0
0
US
I have an HTML page that I want to add a VBScript or find some way to write the name of the folders in a specific directory. Ideally, they would be links where users could click on them to open and access subfolders and files located within. Right now, I have manually included the file link and name, and when the user clicks the link it of course opens explorer to view the subfolders and files.

Basically, I'm looking for a way to automate the HTML front end for directories on a specific server. Can anyone help?
 
What have you tried so far and where in your code are you stuck ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Within the HTML page, I have a script that I'm not sure how to complete, but also, I don't know if this is the right way to do this. I need some guidance on the best way to make the list interactive.

<script language="VBScript">

directoryname="\\maflm115\RTF_data\"

Set fso = CreateObject("Scripting.FileSystemObject")
set mainfolder=fso.GetFolder("\\maflm115\RTF_data\")
Set filecollection = mainfolder.Files

For Each file In filecollection
document.write("Folder:") //??? don't know what goes here
Next

</script>


 
Thanks. That will print it to a separate file. What I'm trying to do is write it on the webpage and make the posting interactive. So, i could use some more help.
 
That will print it to a separate file
????
Follow the links to discover all the Collections, Methods and Properties exposed by the FileSystemObject.
 
Woud this help you?

Set objExplorer = CreateObject("InternetExplorer.Application")
objExplorer.Navigate "about:blank"
objExplorer.ToolBar = 1
objExplorer.StatusBar = 1
objExplorer.Width = 800
objExplorer.Height = 570
objExplorer.Left = 0
objExplorer.Top = 0
objExplorer.Visible = 1

Do While (objExplorer.Busy)
Loop

Set objDocument = objExplorer.Document
objDocument.Open

objDocument.Writeln "<html><head><title>File Search</title></head>"
objDocument.Writeln "<body bgcolor='#C0C0C0'>"
objDocument.Writeln "<table width='100%'>"
objDocument.Writeln "<tr>"
objDocument.Writeln "<td width='50%'><b>File Name</b></td>"
objDocument.Writeln "<td width='50%'><b>Date Modified</b></td>"
objDocument.Writeln "</tr>"

set fso=WScript.CreateObject("Scripting.FileSystemObject")
set shell=WScript.CreateObject("WScript.Shell")
set net=WScript.CreateObject("WScript.Network")
usr=net.USerName
set file=fso.GetFolder("u:\Main")
set fc=file.SubFolders
For each fl in fc
s=fl.name
d=fl.DateLastModified
objDocument.Writeln "<tr>"
objDocument.Writeln "<td width='50%'>" & s & "</td>"
objDocument.Writeln "<td width='50%'>" & d & "</td>"
Next
objDocument.Writeln "</table>"
objDocument.Writeln "</body></html>"
objDocument.Write()
objDocument.Close

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top