Tutorials to .com

Tutorials to .com » Asp » Fso » ASP, FSO directory traversal and file directory

ASP, FSO directory traversal and file directory

Print View , by: iSee ,Total views: 17 ,Word Count: 164 ,Date: Thu, 16 Apr 2009 Time: 4:47 AM

<% @ Language = VBScript%>
<%
'I wrote a directory traversal and file directory of the function,
%>
<%
function bianli (path)
set fso = server.CreateObject ( "scripting.filesystemobject")

on error resume next
set objFolder = fso.GetFolder (path)

set objSubFolders = objFolder.Subfolders

for each objSubFolder in objSubFolders

nowpath = path + "\" + objSubFolder.name

Response.Write nowpath

set objFiles = objSubFolder.Files

for each objFile in objFiles
Response.Write "<br> ---"
Response.Write objFile.name
next
Response.Write "<p>"
bianli (nowpath) 'Recursive

next
set objFolder = nothing
set objSubFolders = nothing
set fso = nothing
end function
%>
<%
bianli ( "d:") 'traverse d: disc
%>


ASP File System Object Articles


Can't Find What You're Looking For?


Rating: Not yet rated

Comments

No comments posted.