fso删除当前文件夹下所有的内容
2008-11-26 20:52
309 查看
<script type="text/javascript"><!--
google_ad_client = "pub-4490194096475053";
/* 内容页,300x250,第一屏 */
google_ad_slot = "3685991503";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>http://www.corange.cn/archives/2008/09/1619.html
<HTML>
<HEAD><TITLE>fso删除当前文件夹中的所有内容</TITLE></HEAD>
<style>
body {font-size:12px;margin-top:20px;margin-left:20px;}
</style>
<BODY>
<%
'功能:删除当前文件夹下所有内容,包括文件夹和文件
'开发:wangsdong
'网站:www.aspprogram.cn
'原创文章,转载请保留此信息
'创建一个FileSystemObject对象的事例
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
'创建一个Folder对象
foldername=server.mappath("./")
Set MyFolder=MyFileObject.GetFolder(foldername)
i=0
'循环显示其中文件夹
For Each thing in MyFolder.subfolders
if MyFileObject.folderExists(thing) then '判断folder文件夹是否存在
t2=thing
MyFileObject.deletefolder thing '删除folder文件夹
response.write "<br>"&t2&"-----文件夹已经删除"
else
response.write "<br>"&thing&"-----文件夹不存在,无法删除"
end if
i=i+1
Next
response.write "共有删除了"&i&"个文件夹<br><br>"
'循环显示其中文件
i=0
For Each thing in MyFolder.Files
if MyFileObject.FileExists(thing) then '判断folder文件夹是否存在
t2=thing
MyFileObject.DeleteFile thing '删除folder文件夹
response.write "<br>"&t2&"-----文件已经删除"
else
response.write "<br>"&thing&"-----文件不存在,无法删除"
end if
i=i+1
Next
response.write "共有删除了"&i&"个文件"
%>
</Body>
</HTML>
google_ad_client = "pub-4490194096475053";
/* 内容页,300x250,第一屏 */
google_ad_slot = "3685991503";
google_ad_width = 300;
google_ad_height = 250;
//-->
</script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>http://www.corange.cn/archives/2008/09/1619.html
<HTML>
<HEAD><TITLE>fso删除当前文件夹中的所有内容</TITLE></HEAD>
<style>
body {font-size:12px;margin-top:20px;margin-left:20px;}
</style>
<BODY>
<%
'功能:删除当前文件夹下所有内容,包括文件夹和文件
'开发:wangsdong
'网站:www.aspprogram.cn
'原创文章,转载请保留此信息
'创建一个FileSystemObject对象的事例
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
'创建一个Folder对象
foldername=server.mappath("./")
Set MyFolder=MyFileObject.GetFolder(foldername)
i=0
'循环显示其中文件夹
For Each thing in MyFolder.subfolders
if MyFileObject.folderExists(thing) then '判断folder文件夹是否存在
t2=thing
MyFileObject.deletefolder thing '删除folder文件夹
response.write "<br>"&t2&"-----文件夹已经删除"
else
response.write "<br>"&thing&"-----文件夹不存在,无法删除"
end if
i=i+1
Next
response.write "共有删除了"&i&"个文件夹<br><br>"
'循环显示其中文件
i=0
For Each thing in MyFolder.Files
if MyFileObject.FileExists(thing) then '判断folder文件夹是否存在
t2=thing
MyFileObject.DeleteFile thing '删除folder文件夹
response.write "<br>"&t2&"-----文件已经删除"
else
response.write "<br>"&thing&"-----文件不存在,无法删除"
end if
i=i+1
Next
response.write "共有删除了"&i&"个文件"
%>
</Body>
</HTML>
相关文章推荐
- Python_删除/创建指定目录及其下所有子目录的文件,该文件记录当前文件夹的内容
- Python_删除/创建指定目录及其下所有子目录的文件,该文件记录当前文件夹的内容
- Unix/Linux Shell: 除 "*.sh"后缀名以外,删除的当前所有文件和文件夹
- java 删除文件夹中的所有内容而不删除文件夹本身
- java单个文件复制,递归删除、复制目录下所有内容,递归创建文件夹,.7z文件解压等
- java调用cmd命令删除文件夹及其所有内容
- grep 查找当前文件夹下所有文件内内容 并显示文件名
- Java删除指定文件夹下的所有内容的方法(包括此文件夹)
- android典型代码系列(十二)------删除某个文件夹里面的所有内容(递归)
- Java新建目录、新建文件、删除文件、删除文件夹、删除文件夹里面的所有文件、复制整个文件夹内容
- 递归删除当前文件夹及当前文件夹下的所有文件
- 删除文件夹及文件夹内部所有内容的标准函数
- 复制文件夹所有内容 和 删除整个文件夹的2个函数
- 复制文件夹所有内容 和 删除整个文件夹的2个函数
- CFileFind删除过期的文件夹下的所有内容
- 遍历删除当前文件夹中所有 .svn 的文件
- PHP实现批量清空删除指定文件夹所有内容的方法
- VC 删除文件夹 及 下面所有内容
- 批量删除当前目录下所有文件夹中的指定文件
- C# j基本操作-拷贝文件夹的所有内容到另一个文件夹内: 复制代码 1 public static void CopyDir(string srcPath, string实现文件夹的复制以及删除