<% '******************************************************* '* ASP 101 Sample Code - http://www.asp101.com/ * '* * '* This code is made available as a service to our * '* visitors and is provided strictly for the * '* purpose of illustration. * '* * '* http://www.asp101.com/samples/license.asp * '* * '* Please direct all inquiries to webmaster@asp101.com * '******************************************************* %> <% 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 = "./dir/" ' Create our FSO and get a handle on our folder Set objFSO = Server.CreateObject("Scripting.FileSystemObject") Set objFolder = objFSO.GetFolder(Server.MapPath(strPath)) ' Just list files: For Each objItem In objFolder.Files Response.Write "" _ & objItem.Name & "
" & vbCrLf Next 'objItem ' Done! Kill off our object variables. Set objItem = Nothing Set objFolder = Nothing Set objFSO = Nothing %>