在这些例子,我们将创建和删除子目录内cgi - bin目录在我们的网站。许多人常常我们将有权限来执行这个行动不仅在此目录中。
创建文件夹名称"www.111cn.net"
<%
Foldertocreate=server.mappath("") &"/cgi-bin/myfiles"
Set fs = CreateObject("Scripting.FileSystemObject")
Set a = fs.CreateFolder(Foldertocreate)
Set fs=nothing
%>
Done
删除文件 "www.111cn.net"
<%
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
%>
Done
www.111cn.net
时间: 2024-10-03 00:16:07