Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Aug 2005
    Posts
    252
    Thanks
    23
    Thanked 0 Times in 0 Posts

    brainjar asp directory list script produces error

    Actually, I found a different script. Any way for this to be modified so that it hides this file (which I've named index.asp??

    Code:
    <html>
    <head><title>File List</title>
    </head>
    <body>
    
    <ol>
    <%
    Set myFileSys = Server.CreateObject("Scripting.FileSystemObject")
    Set Folder = myFileSys.GetFolder(Server.MapPath("/ais"))
    for each file in Folder.Files
     FileName = Left(file.name, (Len(file.name) - 4)) 'drop the extension
     FileSize = cint(file.size / 1024) 'convert into kilobytes and drop the decimal
     Response.Write("<li><a href='/" & file.name & "'>" & FileName & "</a> - " & FileSize & " K<br>" & chr(13))
    next
    
    Set myFileSys = nothing
    %>
    </ol>
    </body>
    </html>
    Last edited by Errica; 09-19-2007 at 04:33 PM. Reason: Found a different script

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    well.... you can see that the file name is in the file.name property, right?

    so maybe you could do something like....

    if file.name = "index.asp" then
    ' do nothing
    else
    ' do some stuff
    end if


  •  

    Posting Permissions

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