使用asp创建与删除文件与文件夹的方法
创建文件夹名称www.diggcms.cn
<%
Foldertocreate=server.mappath("www.diggcms.cn")
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateFolder(Foldertocreate)
Set fs=nothing
response.Write "创建文件夹"&Foldertocreate&"成功"
%>
Done
删除文件 "www.diggcms.cn"
<%
Foldertodelete=server.mappath("www.diggcms.cn")
Set fs = CreateObject("Scripting.FileSystemObject")
fs.DeleteFolder(Foldertodelete)
Set fs=nothing
response.Write "删除文件夹"&Foldertocreate&"成功"
%>
Done
删除文件夹,判断文件夹存在时再删除.
<%
Foldertodelete=server.mappath("www.diggcms.cn")
Set fs = CreateObject("Scripting.FileSystemObject")
if fs.FolderExists(Foldertodelete) then
fs.DeleteFolder Foldertodelete
end if
Set fs=nothing
%>
- 上一篇:最大限度优化你的Asp性能
- 下一篇:asp For Each语句实例