Posted By

wizard04 on 04/28/10


Tagged

file ASP vbscript


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

asifrizvigmailcom
britevents
nickian


List files in a directory


 / Published in: ASP
 

  1. <%
  2. function getListOfFiles(path)
  3. dim fs, folder, list(), ub
  4. set fs = CreateObject("Scripting.FileSystemObject")
  5. set folder = fs.GetFolder(path)
  6. ub = -1
  7. for each file in folder.Files
  8. ub = ub+1
  9. redim preserve list(ub)
  10. list(ub) = file.Name
  11. next
  12. getListOfFiles = list
  13. end function
  14.  
  15. dim files : files = getListOfFiles(server.MapPath("/images"))
  16. for each name in files
  17. response.Write(name&"<br>")
  18. next
  19. %>

Report this snippet  

You need to login to post a comment.