时间:2021-07-01 10:21:17 帮助过:55人阅读
<% Set fso = CreateObject("Scripting.FileSystemObject") Set fldr = fso.GetFolder("c:\Program Files") Response.Write "父文件夹名字是:" & fldr & "<br>" If fldr.IsRootFolder = True Then Response.Write "该文件夹是一根文件夹" & "<br>" Else Response.Write "该文件夹不是根文件夹" & "<br>" End If Response.Write "驱动器名字是:" & fldr.Drive & "<br>" %> |
<% Set fso = CreateObject("Scripting.FileSystemObject") fso.CreateFolder ("c:\cnbruce") Response.Write "文件夹名为" & fso.GetBaseName("c:\cnbruce") %> |
<% Set fso = CreateObject("Scripting.FileSystemObject") fso.DeleteFolder("c:\cnbruce") Response.Write "文件夹已删除" %> |
<% dir=server.mappath("cnbruce") Set fso = CreateObject("Scripting.FileSystemObject") if (fso.FolderExists(dir)) then fso.DeleteFolder(dir) response.write("cnbruce文件夹已经删除") else fso.CreateFolder(dir) response.write("cnbruce文件夹已经建立") end if %> |
<% Sub CreateAFolder(file) Dim fso Set fso = CreateObject("Scripting.FileSystemObject") fso.CreateFolder(file) response.write "已经建立了"&file End Sub Sub DeleteAFolder(file) Dim fso Set fso = CreateObject("Scripting.FileSystemObject") fso.DeleteFolder(file) response.write "已经删除了"&file End Sub %> <% subname=request.form("submit") create=request.form("create") del=request.form("del") if subname<>"" then if create<>"" then call CreateAFolder(""&create&"") end if if del<>"" then call DeleteAFolder(""&del&"") end if end if %> <form action="mainflr.asp" method="post"> <input name="create"> <input type="submit" value="建立" name="submit"> </form> <hr> <form action="mainflr.asp" method="post"> <input name="del"> <input type="submit" value="删除" name="submit"> </form> |
<% Set fso = CreateObject("Scripting.FileSystemObject") fso.CreateFolder ("c:\cnbruce") fso.MoveFolder "c:\cnbruce", "C:\Program Files\" %> <a href="C:\Program Files\">查看cnbruce文件夹有没有移动过来</a> |
<% Set fso = CreateObject("Scripting.FileSystemObject") fso.CopyFolder "c:\Program Files\cnbruce", "c:\" %> <a href="C:\">查看cnbruce文件夹有没有复制过来</a> |