FSO操作文件系统(11)


sFileName
 If InStr(1,path,":\")=0 Then 
 path=Replace(path,"\","/")
 uploadPath = server.mappath(path)
 Else
 path=Replace(path,"/","\")
 uploadPath=path
 End If 
response.write(warn_red(uploadPath))
if not fso.folderexists(uploadPath) Then
response.write warn_red("路径查找失败")
Exit Function 
End If 
Set uploadfolder = fso.GetFolder(uploadPath)
If uploadfolder.isrootfolder Then 
response.write("<b>根目录</b><br/>")
Else
response.write("<b><font color=""#00008b"">父目录:</font><a href=""default.asp?action=fso&this=top&path="&uploadfolder.parentfolder&""">
"&uploadfolder.parentfolder&" </a></b><br/>") 

End If 
response.write("<b>目录大小:"&int(uploadfolder.size/1024)&" KB</b><br/>") 
set objSubFolders=uploadfolder.Subfolders
Dim fso_mes
fso_mes="<ol>"
for each objSubFolder in objSubFolders
fso_mes=fso_mes& "<li><b><a href=""default.asp?action=fso&this=top&path="&path&"/"&objSubFolder.name&"""><font color=blue>" & objSubFolder.name & "</font></a></b></li>"
next
set allfiles = uploadfolder.Files
for each fileitem in allfiles
 fso_mes=fso_mes& "<li><a href=""default.asp?action=fso&this=file&path="&path&"/"&fileitem.Name&""">" & fileitem.Name & "</a></li>"
Next
fso_mes=fso_mes&"</ol>"
response.write(fso_mes)
response.write deltext(uploadPath,1)
End Function

 

'文件属性
Function filepro(name)
name=Replace(name,"//","/")
Dim whichfile
If InStr(1,name,":\")=0 Then 
name=Replace(name,"\","/")
whichfile = server.mappath(name)
Else
name=Replace(name,"/","\")
whichfile=name
End If 
Set fso = CreateObject("Scripting.FileSystemObject")
If Not fso.fileexists(whichfile) Then 
 response.write(warn_red("文件不存在或者无访问权限"))
 Exit Function 
End If 
Dim f2,s_mess
Set f2 = fso.GetFile(whichfile)
s_mess = "<div class=""admin_post_form""><b><font color=""#00008b"">父目录:</font><a href=""default.asp?action=fso&this=top&path="&f2.parentfolder&""">"&f2.parentfolder&
"</a></b><br/>"
s_mess = s_mess & "文件名称:" & f2.name & "<br>"
s_mess = s_mess & "文件短路径名:" & f2.shortPath & "<br>"

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/3693.html