Example of files with the ASP traversal

xiaoxiao2021-03-06  42

<% 'By Aloxy, E-mail: szyjj @ Hotmail.com, OICQ: 33162229SUB LISTFOLDERCONTENTS (PATH)

DIM FS, FOLDER, FILE, ITEM, URL

SET FS = CreateObject ("scripting.filesystemObject") SET Folder = fs.getFolder (PATH)

'Display The Target Folder and Info.

Response.write ("

  • " & folder.name & " -" _ & folder.files.count & "files,") if folder.subfolders.count> 0 Then Response.write Folder.subfolders.count & "Directories,") End if Response.write (Round (Folder.Size / 1024) & "KB Total." _ & VBCRLF)

    Response.write ("

      " & VBCRLF)

      'Display a list of sub belly.

      For each item in folder.subfolders listFolderContents (item.path) Next

      'Display a list of files.

      For each item in folder.files url = mapurl (item.path) Response.write ("

    • " & item.name & "" & vbcrlf) Next

      Response.write ("" & VBCRLF)

      Response.write ("" & vbrlf)

      End Sub

      Function Mapurl (PATH)

      Dim rootpath, URL

      'Convert a Physical File path to a url for hypertext links.

      Rootpath = Server.mappath ("/") URL = Right (path, len (path) - Len (rootpath) mapURL = Replace (URL, "/", "/")

      End function%>

  • 转载请注明原文地址:https://www.9cbs.com/read-53429.html

    New Post(0)