给你想到了一个简单的。fd.size=0就是无文件。
function DelDir(sPath)
dim fso,fd
Set fso = CreateObject("Scripting.FileSystemObject")
Set fd = fso.GetFolder(sPath)
if fd.size=0 then '无文件
.....
如果是客户端执行,可去掉'注释部分.
function DelDir(sPath)
dim fso,f,fc
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder(sPath)
Set fc = f.Files
if fc.Count>0 then
'dim ans
'ans=MsgBox("不为空,删除吗?",vbOKCancel)
'if ans=vbOK then
f.Delete
'end if
end if
set fc=nothing
set f=nothing
set fso=nothing
给你这个,我自己写的。
'----------------------------检查目录占用情况函数--------------------------------------------
Function Spacess(filepath)
On Error Resume Next
set fso=server.createobject("scripting.filesystemobject")
set Files=fso.getfolder(server.mappath(filepath))
if Err <> 0 Then Spacess="该空间不支持FSO组件,无法计算空间占用情况!"
if Files.size < 1048576 Then
Spacess = Round((Files.size/1024),2)&" KB"
elseif Files.size > 1048576 and Files.size < 1073741824 Then
Spacess = Round((Files.size/1048576),2)&" MB"
else
Spacess = Round((Files.size/1073741824),2)&" GB"
end if
End Function