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
%>
<%
'*****************************
'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
%>
相关文章推荐
- asp.net 删除项目文件/文件夹IIS重启,Session丢失问题
- asp.net ftp 上传,下载,删除文件,创建文件夹,删除文夹,重命名类
- asp.net 删除文件夹,指定文件夹,删除文件夹和所有文件,删除权限设置,递归删除文件夹目录及文件
- ASP.NET对文件的操作,创建文件,判断文件是否存在,判断文件是否存在删除文件夹
- 转: KindEditor 图片空间文件增加删除文件、文件夹功能(ASP语言环境)
- asp.net删除文件夹里的文件
- asp删除文件夹中的文件
- Asp.Net 文件操作基类(读取,删除,批量拷贝,删除,写入,获取文件夹大小,文件属性,遍历目录)
- asp.net删除文件夹里的所有文件
- Asp.Net_文件操作基类(读取,删除,批量拷贝,删除,写入,获取文件夹大小,文件属性,遍历目录)
- asp结合fso实现文件或文件夹创建删除等操作的函数
- asp.net创建、删除、移动文件夹 文件
- ASP.NET MVC 启动定时任务删除某一文件夹下面的全部文件
- asp.net 删除文件夹,指定文件夹,删除文件夹和所有文件,删除权限设置,递归删除文件夹目录及文件
- Asp.Net 文件操作基类(读取,删除,批量拷贝,删除,写入,获取文件夹大小,文件属性,遍历目录)
- ASP删除黑客建立的只读文件夹和文件
- Asp.Net 文件操作基类(读取,删除,批量拷贝,删除,写入,获取文件夹大小,文件属性,遍历目录)(一)
- asp.net 递归删除文件夹及其子文件夹和所有文件[转]
- asp.net如何删除文件夹及文件内容操作
- asp.net 文件夹和文件的创建、删除