天涯之外

导航

asp 创建与删除文件与文件夹

创建文件夹名称"www.236z.com"

<%
Foldertocreate=server.mappath("") &"/cgi-bin/myfiles"  
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateFolder(Foldertocreate) 
Set fs=nothing
%>
Done
 

删除文件 www.236z.com

<%
Foldertodelete=server.mappath("") &"/cgi-bin/111cn"  
Set fs = CreateObject("Scripting.FileSystemObject")
fs.DeleteFolder(Foldertodelete) 
Set fs=nothing
%>
Done
 

删除文件夹,判断文件存在时再删除.

<%
Foldertodelete=server.mappath("") &"/cgi-bin/myfiles"  
Set fs = CreateObject("Scripting.FileSystemObject")
   if fs.FolderExists("c:temp") then
      fs.DeleteFolder "c:temp"
   end if
Set fs=nothing
%>

posted on 2009-11-12 17:15  天涯之外  阅读(394)  评论(0编辑  收藏  举报