How to list your files

Discussion in 'Site Programming, Development and Design' started by Ayrehead, Nov 7, 2017.

  1. Here is an ASP script that gives a listing of all files on your site and their path. I run this periodically and use a diff tool to compare the output with the previous one. It highlights changes so i can look for possible problems. For example if a hacker puts a new file there (it happened at another host).

    <% @LANGUAGE = VBScript %>
    ' Lists all files on website
    Option Explicit
    Response.Expires = 0
    response.write Date & "<br />"

    Sub ExamineFolders(objFolder)
    Dim Folder, File
    Response.Write "<br />" & objFolder.Path & "<br />"

    For each File in objFolder.Files
    Response.Write File.Name & "<br />"

    For each Folder in objFolder.SubFolders
    ExamineFolders Folder
    End Sub

    ' Main Prog
    Dim objFS, objRootFolder, strVRoot
    Set objFS=Server.CreateObject("Scripting.FileSystemObject")
    Set objRootFolder=objFS.GetFolder(strVRoot)
    ExamineFolders objRootFolder
    Michael likes this.
  2. It's always good to do a file check like this. Especially if you're using any third-party applications or code.

Share This Page