For a guide to the choosing ASP or PHP, click here
Home >> Text Files >> List all Files and folders in a Directory This bit of code will display all the files and folders inside the given directory.
<% ' declare variables dim fso, fsodir, ourDir, ourItem ' declare the folder ourDir = "folderName" ' prepare the system variables Set fso = Server.CreateObject("Scripting.FileSystemObject") Set fsodir = fso.GetFolder(Server.MapPath(ourDir)) ' loop through the sub directories for each ourItem in fsodir.SubFolders response.write("directory: " & ourItem.Name & " ") next ' loop through the files for each ourItem in fsodir.Files response.write("file: " & ourItem.Name & " ") next ' clean up server variables Set ourItem = nothing Set fsodir = nothing Set fso = nothing %> What is ASP?
"; } // check to see if it is a file if (is_file($ourItem)) { echo "file: $ourItem "; } } closedir($ourDirList); ?> What is PHP?