Home | Advertising Info32 USERS CURRENTLY ONLINE   
   Site Search Contact Us Thursday, June 30, 2022  

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.

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

<% =filefound.Name %>

<% Next %>

The results might look something like this.


   Active Server Pages Rule The World
Contact Us  
All artwork, design & content contained in this site are Copyright 1998 - 2022 PowerASP.com and Christopher J. Williams
Banner ads ,other site logos, etc are copyright of their respective companies.
STATS Unless otherwise noted - All Rights Reserved.

vbscript active server pages ASP vbscript SQL database informix oracle SQL Server Perl CGI Delphi PHP source code code sample samples program CJWSoft ASPProtect ASPBanner ASPClassifieds www.aspclassifieds.com, www.powerasp.com,www.cjwsoft.com,www.aspphotogallery.com,www.codewanker.com,www.aspprotect.com,www.aspbanner.com