Results 1 to 2 of 2

Thread: FSO_ HELP PLease

  1. #1
    NICHE Guest

    Default FSO_ HELP PLease

    I&#039;m trying to display a folder, the subfolders in it, and the subfolders in it. This is a repetitive task, and subfolders can be limitless. I can do this by creating asp pages for each subfolder, but thats pointless. How would you create a simple program to do this using FSO??? I thought of everything. Please help. <BR><BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: FSO_ HELP PLease

    You want to display *all* the files on a single page?<BR><BR>Ever heard of "recursion"?<BR><BR>All you have to do is have a "displayFolder" routine that calls itself for each subfolder it finds. <BR><BR>This is the idea. I&#039;m too lazy to go look up the property and method names for FSO, but I think you can alter my code as needed:<BR><BR>&#060;%<BR>Sub displayFolder( fldr, ByVal indent )<BR>&nbsp; &nbsp; &#039; add a level of indentation<BR>&nbsp; &nbsp; indent = indent & "&amp;nbsp;&amp;nbsp;"<BR>&nbsp; &nbsp; &#039; first do all the subfolders of the current folder<BR>&nbsp; &nbsp; For each subf In fldr.SubFolders<BR>&nbsp; &nbsp; &nbsp; &nbsp; &#039; the + sign indicates a folder name<BR>&nbsp; &nbsp; &nbsp; &nbsp; Response.Write indent & "+" & subf.Name & "&lt;BR&#062;"<BR>&nbsp; &nbsp; &nbsp; &nbsp; &#039; and here&#039;s the recursive call to ourselves:<BR>&nbsp; &nbsp; &nbsp; &nbsp; displayFolder( subf, indent )<BR>&nbsp; &nbsp; Next<BR>&nbsp; &nbsp; &#039; after all the subfolders finally come all the files<BR>&nbsp; &nbsp; For each fl In fldr.Files<BR>&nbsp; &nbsp; &nbsp; &nbsp; &#039; the - sign means a file name instead of folder name<BR>&nbsp; &nbsp; &nbsp; &nbsp; Response.Write indent & "-" & fl.name & "&lt;BR&#062;"<BR>&nbsp; &nbsp; Next<BR>End Sub<BR>%&#062;<BR><BR>Just find the folder you want to start at and pass it to that routine and presto.<BR><BR><BR>&nbsp; &nbsp; &nbsp; &nbsp;

Posting Permissions

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