devxlogo

FTP Directory Listing

FTP Directory Listing

Question:
How can I dynamically create a web page from an FTP directory listing of files with a particular extension?

Answer:
While there are sophisticated components (.DLLs) that you could add in, you could also use the FileSystemObject and do a little filtering in the ASP script. Here’s one approach, that builds on the sample code found in the IIS4 online help:

Sub ShowFolderList(folderspec)Dim fs, f, f1, fc, sSet fs = Server.CreateObject("Scripting.FileSystemObject")Set f = fs.GetFolder(folderspec)Set fc = f.FilesFor Each f1 in fcIf instr(f1.name,".zip") thenresponse.write f1.name & "
" end ifNextEnd SubShowFolderList("e:inetpubftproot")

devx-admin

Share the Post: