ASP如何获取系统文件夹路径? 就是文本框的内容是文件夹路径,此路径是从后面点浏览系统而获得的

来源:百度知道 编辑:UC知道 时间:2024/05/17 08:32:42
我要做的是一个表单,有一项内容是文件保存路径, 这个路径要求通过遍历系统文件夹获得,做过的朋友请指点下:

'/**
' * 遍历目录下的所有目录(包括子目录)
' * @params string sPath - 初始路径
' * @params bool bAll - 是否遍历子目录
' */
Function Traversal(ByVal sPath, ByVal bAll)
Dim I
Dim oKey, pKey
Dim nItem, nPath
Dim oDic, oItems, oArray
Set oDic = Server.CreateObject("Scripting.Dictionary")
For Each nItem In System.IO.FSO.GetFolder(Server.MapPath(sPath)).SubFolders '调用FSO
nPath = sPath & nItem.Name & "/"

oKey = System.Security.MD5(nPath, 32) 'MD5加密
If Not oDic.Exists(oKey) Then oDic.Add oKey, nPath

If StrComp(bAll, "True", 1) = 0 Or CBool(System.Text.ToNumeric(bAll)) = True Then
oArray = Traversal(nPath, True) '递归
For I=0 To UBound(oArray)
pKey = System.Security.MD5(oArray(I)