Results 1 to 8 of 8

Thread: Directory Listing in HTML

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Posts
    17
    Something about the number of responses here tells me I wont get an answer anytime in the near future... But i'm gonna ask anyway...


    I'm making a webpage for file downloads, and I want it to always be current with the files that are available in the directory.

    I figured if there was some way to get a HTML listing of the files in the directory, it would really take a load off. Anyone have a clue?

    <~Whisper~>

  2. #2
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    292
    Do you have access to any server side programming/scripting for this page?
    "People who think they know everything are a great annoyance to those of us who do."

  3. #3

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Posts
    17
    Yes. I have full access to everythin... Fire away!!

  4. #4
    New Member
    Join Date
    May 2000
    Posts
    15
    Does full access mean you have a cgi-bin directory that you can put scripts in that can be executed from a client browser?

  5. #5
    Hyperactive Member
    Join Date
    Mar 2000
    Posts
    292
    If you can run ASP pages this might help you out:
    http://www.asptoday.com/articles/19990319.htm
    "People who think they know everything are a great annoyance to those of us who do."

  6. #6
    Guest
    If you have rights to run ASP scripts and create an instance of the "Scripting.FileSystemObject" object then this code should be good for you:

    Code:
    <%@ Language=VBScript %>
    <html>
      <head>
        <title>News & Bulletins</title>
      </head>
      <body bgcolor="#FFFFFF" link="#FF9A09" text="#000099" vlink="#000099">
        <font face="Arial">
          <%
            dim Files, Folder, fsoFile
            set fsoFile = Server.CreateObject("Scripting.FileSystemObject")
            set Folder=fsoFile.GetFolder(server.MapPath("."))
            set files = Folder.Files
    
            if files.count<>0 then
              for each file in files
                if lcase(right(file,5)) = ".html" then
                  %>
                    <a href="<%=server.urlpathencode(fsoFile.GetBaseName(file))%>.html"><%=fsoFile.GetBaseName(file)%></a><br>
                  <%
                end if
              next
            end if
    
            set fsoFile = Nothing
          %>
        </font>
      </body>
    </html>
    As it stands the code only lists ".html" files and hides the file extension (but I'm sure a smart person like you can sort that out! )

    As for the colour scheme... Lets just say that it looks ok when you see the rest of the site I created it for (corporate colours and all that).

    Chiow!

    [Edited by matthewralston on 05-26-2000 at 09:49 AM]

  7. #7
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    depending on how the server's set up, if you just don't put an index.html file (or something similar) in a folder, you either get a directory listing generated by the client browser, or a message telling you it's forbidden to browse. If the former, then you're fine, if the latter, then the clever people here have already told you what to do.

  8. #8

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Posts
    17

    Talking

    Verry nice, matthewralston... I had originaly used the "no-html file in the directory" (tacky) method of creating a file listing, but it seems this works very efficiently

    Thanx a million...

    ~~Whisper~~

Posting Permissions

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



Click Here to Expand Forum to Full Width