Joined: April/26/2004 Location: United States
Online Status: Offline Info: 137
Added: April/27/2004 at 8:14pm | IP Logged
Show Directory Contents Using ASP
This is an example of using the FileSystemObject to list the files in a directory. Replace "somedirectory" with your directory name. Replace "somedirectory" with your directory name. If you know the physical path you can replace Server.MapPath("/somedirectory") with the actual path like so. "E:\Inetpub\virtuals\somesite\somedirectory"
Here's the catch. If you are using NT the directory you run this on must have the correct permissions. Basically the directory needs "read" permissions from the anonymous account or you will get a permission denied error.
<% Set MyDirectory=Server.CreateObject("Scripting.FileSystemObject" ) Set MyFiles=MyDirectory.GetFolder(Server.MapPath("/somedirectory ")) For each filefound in MyFiles.files %>
You cannot add new info in this area You cannot add to info in this area You cannot delete your info in this area You cannot edit your info in this area You cannot create polls in this area You cannot vote in polls in this area