471,049 Members | 1,550 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,049 software developers and data experts.

Able to list and display all file names in a folder but how to iterate the filenames?

Hi, i want to display all the filenames on browser. However i found that if there are many filenames in that folder, result will be it will display a long list of filenames on that browser.

My question is how do i iterate the file names with 5 filenames on each page?

I have manage to retrieve and display the filenames with the codes below. Can anyone help me or give advice on how to do the iteration?
The codes are below and able to list filenames
Expand|Select|Wrap|Line Numbers
  1. <%@ Language=VBScript %> 
  2.     <HTML> 
  3.     <BODY> 
  4.     <% 
  5.     Dim objFileScripting, objFolder 
  6.     Dim filename, filecollection, strDirectoryPath, strUrlPath, newName 
  8. strDirectoryPath="c:\inetpub\scripts\" 
  9.         strUrlPath="\scripts\" 
  11.         'get file scripting object 
  12.         Set objFileScripting = CreateObject("Scripting.FileSystemObject") 
  13.         'Return folder object 
  14.         Set objFolder = objFileScripting.GetFolder("C:\ASP collection\NYGH\Accolade") 
  15.         'return file collection In folder 
  16.         Set filecollection = objFolder.Files 
  17.         'create the links 
  19.                 For Each filename In filecollection 
  20.             Filename=right(Filename,len(Filename)-InStrRev(Filename, "\")) 
  21.             x=len(Filename) 
  22.             newName = left(Filename ,x-4) 
  23.             Response.Write "<A HREF=""" & strUrlPath & filename & """>" & newName & "</A> 
  24.         Next 
  26.     %> 
  27.     </BODY> 
  28.     </HTML> 
Thanks in advance
Aug 1 '07 #1
0 2381

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

7 posts views Thread by Al Kolff | last post: by
7 posts views Thread by Dave Navarro | last post: by
13 posts views Thread by Chris Johnson | last post: by
10 posts views Thread by Abubakar | last post: by
6 posts views Thread by eso40043 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.