How Do I list Files from a Folder

Results 1 to 2 of 2

Thread: How Do I list Files from a Folder

  1. #1
    Daniel Lugo Guest

    Default How Do I list Files from a Folder

    What I want: Display all the files of a folder<BR><BR>What I have Done so far: I tried to use a File Collection Object to manage files inside a folder.<BR><BR>Problems:<BR><BR>I can only use the colFileObject.Count Property which returns the number of files in the folder AND the colFileObject.Item property to get a specific File Object; However, I cannot use a numeric index to display the items in the Files collection <BR><BR><BR>If you know the solution please responde to<BR>Thanks.

  2. #2
    Daniel Guest

    Default RE: How Do I list Files from a Folder

    I found this code in a book, and works well. <BR>Book: (Active Server for Dummies 2 Edition by Bill Hatfield Page 133)<BR><BR><BR>&#039DECLARING OBJECTS<BR>Dim objFSO &#039Creates a File System Object<BR>Dim objFolder &#039Creates a Folder Object <BR>Dim fileobj &#039Holds a file Object from a FileCollectionObject<BR>Dim colFiles &#039Its a File Collection of a Folder Object <BR><BR>&#039CREATE A FILE SYSTEM OBJECT<BR>Set objFSO = CreateObject("Scripting.FileSystemObject")<BR><BR> &#039CREATE A FOLDER SYSTEM OBJECT by using the Get Method<BR>Set objFolder = objFSO.GetFolder("c:MyDocuments")<BR><BR>&#039CREA TE A FILE COLLECTION OBJECT<BR>Set colFiles = objFolder.files<BR><BR>&#039FOR LOOP TO DISPLAY EACH FILE OF A FOLDER<BR> <BR>&#060;% For Each fileobj in colFiles %&#062;<BR>&#060;% response.write %&#062; <BR><BR>&#060;% Next %&#062;<BR><BR>Good Luck!!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts