Getting directory listings from a client machine

C

Carolyn Speakman

Hi,

I need to get a directory listing from a client machine. The directory will
be specified by the user and the results will be stored on the server in an
xml file. I've been trying to use the fillowing code, but I'm not sure if it
will work or just look for the directory on the server. Any help out there?

<%
Dim strPath 'Path of directory to show
Dim objFSO 'FileSystemObject variable
Dim objFolder 'Folder variable
Dim objItem 'Variable used to loop through the folder contents

' Relative path to directory:
strPath = "C:\someDirectory\"

' Create our FSO and get a handle on our folder
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strPath)
Set a = objFSO.CreateTextFile("c:\Inetpub\wwwroot\testfile.xml", True)
a.WriteLine("<?xml version=""1.0"" encoding=""ISO-8859-1""?>" & Chr(13))
a.WriteLine("<root>")

For Each objItem In objFolder.Files
sommat = split(objItem.Name, ".")
if sommat(ubound(sommat)) = "exe" Then
Response.Write "<a href=""" & strPath & objItem.Name & """>" _
& objItem.Name & "</a><br />" & vbCrLf
a.WriteLine("<program>")
a.WriteLine("<name>" & objItem.Name & "</name>")
a.writeLine("<size>" & objItem.Size & "</size>")
a.WriteLine("<DateCreated>" & objItem.DateCreated & "</DateCreated>")
a.WriteLine("</program>")
End If
Next 'objItem
a.WriteLine("</root>")
a.Close
' Done! Kill off our object variables.
Set objItem = Nothing
Set objFolder = Nothing
Set objFSO = Nothing
%>

Thanks,
Carolyn
 
J

Jeff Cochran

I need to get a directory listing from a client machine. The directory will
be specified by the user and the results will be stored on the server in an
xml file. I've been trying to use the fillowing code, but I'm not sure if it
will work or just look for the directory on the server. Any help out there?

1) If you have tried the code, you will have answered your question.

2) To do client-side things you need to use client-side coding. ASP
is server-side.

3) http://www.aspfaq.com/show.asp?id=2055

Jeff
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,230
Members
46,817
Latest member
DicWeils

Latest Threads

Top