您的位置:首页 > 编程语言 > ASP

ASP,删除文件夹,文件.

2007-07-23 17:46 309 查看
今天受朋友所托,写了段Asp删除文件夹,文件的.

<%
'*****************************
'Author:William
'Function : delete files of folder
' 每个月1号,删除
'Explain: 建立一个文件夹"TempFolder" ,放入一些测试文件.就可以了.
'*****************************
Dim theDay ' 返回几号
Dim Path,fso,f,fc

theToday_Day = Day(now())
If theToday_Day = "1" Then
Set fso =CreateObject("Scripting.FileSystemObject") '建立一个FileSystemObject
Path = Server.MapPath("TempFolder/")
Set f = fso.GetFolder(Path)
'Function Delete(Str,Path) '========== 可以封装为函数 Begin
Set fc = f.Files
For Each f In fc
If fso.FileExists(f) Then
fso.DeleteFile(f)
End If
'If fso.FolderExists(f) Then
'fso.DeleteFolder(f)
'End If
Next
'End Function '========== 可以封装为函数 End
'Response.Write("Ok")
End If
%>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐