|
Hi!
try this code:
<!----------------------------default.asp---------------- --------->
<div align="center"> <center> <table width="500" cellpadding="3" bgcolor="#000000" cellspacing="1"> <tr> <td width="100%" bgcolor="#C0C0C0"> FileName </td> </tr> <% 'set the folder of system and the starting path of the folder to list 'if you keep the links to files on list, then this folder must be the 'folder where you have this file; otherwise the links to the files on list will not work Path = "C:\Inetpub\listfolders" 'select a subfolder to list and specify the rest of patch of teh selected folder 'if request the list of folder1, then If Request.Querystring("list") = "folder1" Then 'the rest of path to this folder is ListFolder = "mysubfolders\folder1" 'if request the list of folder2, then ElseIf Request.Querystring("list") = "folder2" Then 'the rest of path to this folder is ListFolder = "mysubfolders\folder2" 'if request the list of folder3, then ElseIf Request.Querystring("list") = "folder3" Then 'the rest of path to this folder is ListFolder = "mysubfolders\folder3" 'if not request a folder, then list the links to your files on your subfolders ElseIf Request.Querystring("list") = "" Then %> <tr> <td width="100%" bgcolor="#FFFFFF"> <a href="default.asp?list=folder1">List the files of folder 1</a> <br> <a href="default.asp?list=folder2">List the files of folder 2</a> <br> <a href="default.asp?list=folder3">List the files of folder 3</a> </td> </tr> <% 'end of select subfolders End If 'create the object to list files of your subfolders Set fs = Server.CreateObject("Scripting.FileSystemObject") 'we already have the beginning of system folder path and the rest of path '(the subfolder to list), then, lets set the path to the object list Set folder = fs.GetFolder("" & path & "\" & ListFolder & "") 'now lets list the files for each file in folder.Files 'exclude this file from list If file.name <> "default.asp" then %> <tr> <td width="100%" bgcolor="#FFFFFF"> <a href="<%= ListFolder %>/<%= file.name %>"><%= file.name %></a> </td> </tr> <% 'end of default.asp exclusion from list end if 'create and list next file in new row next 'if you are seeing a list of files from a subfolder, then, show a row with a link to back to the list of subfolders If Request.Querystring("list") <> "" Then %> <tr> <td width="100%" bgcolor="#C0C0C0" align="center"> <a href="javascript:history.back(-1)">Back to the list of folders</a> </td> </tr> <% 'end of row with the link to back to the subfolders End If %> </table> </center> </div>
<!------------------------------end of file------------------------>
i have tested this codeand it work fine on my server. i put just 3 subfolders, now you modify it to add how many subfolders to list as you need. i have exclude the file default.asp from list, so, you can exclude other files from list too.
sorry about my english, its terrible... my asp too, but if i can help in anymore, just post again :)
[]'s for all;
Bborg
.
------------- (sorry about my english... its terrible!!)
I also was born bare, bald and without teeth!!!
|