dir function like visual basic

S

Scott Baxter

Is there a way I can do the equivalent of the 'dir' function on the server
where my asp pages are, or a dir on any directory on my server? I know
there is, I just haven't seen it. Any examples would be appreciated.
 
M

Maarten

Search the Internet for info cc Scripting.FileSystemObject

Set FSO = CreateObject ("Scripting.FileSystemObject")
For Each FSOfile In FSOfiles
if Instr(Ucase(FSOfile),"GO-AWAY") then GoAway=1: Exit For
next
 
M

Maarten

Sorry forgot a line

Set FSO = CreateObject ("Scripting.FileSystemObject")
Set FSOFiles = FSO.GetFolder("upload").Files
For Each FSOfile In FSOfiles
if Instr(Ucase(FSOfile),"GO-AWAY") then GoAway=1: Exit For
next
 
S

Scott Baxter

Hello,

Your help worked like a champ. Here's the code I came up with to list my
root directory:

<%
Set FSO = CreateObject ("Scripting.FileSystemObject")
Set FSOFiles = FSO.GetFolder(Server.MapPath("/")).Files
For Each FSOfile In FSOfiles
response.write FSOfile
response.write "<br>"
if Instr(Ucase(FSOfile),"GO-AWAY") then GoAway=1: Exit For
next
%>

Thanks again.
 
Y

Yuri Weinstein \(HotMail\)

How did you define Server object?

Can you post a complete code?

Thx
YuriW
 

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

No members online now.

Forum statistics

Threads
474,102
Messages
2,570,645
Members
47,246
Latest member
TemekaLutz

Latest Threads

Top