Operate the driver, then it is to operate the folder. These include: extract folder information, create folders, delete folders, copy folders, mobile folders, etc. The following is specifically. First, Fso.Getfolder understands that it is the extraction folder. Is that specific to extract which folder? Behind it is definitely the path to a folder. Apply the folder related information again? Is there a specific extraction. So, look at the program: 1, getfldr.asp
<% Set fso = createObject ("scripting.filesystemObject") set fldr = fso.getFolder ("C: / Program Files") response.write "parent folder name is:" & FLDR & "
" if Fldr. IsRootFolder = true thrite.write "This folder" & "
" Else Response.write "This folder is not root folder" & "
" End ifresponse.write "drive name is : "& Fldr.drive &"
"%>
The connection to establish an FSO component is essential, then set fldr = fso.getFolder ("C: / Program Files") Sets the FLDR object to be assigned to make a reference to the following programs. FLDR.ISRootfolder is to determine if the folder is a folder, the value is a true or false; FLDR.DRIVE displays the drive letter in the folder. Second, fso.createfolder is more exciting to establish a folder through the ASP, you can establish any folder anywhere within your power. 2, Creatfldr.asp
<% Set fso = createObject ("scripting.filesystemObject") fso.createfolder ("c: / cnbruce") response.write "folder name" & fso.getBaseName ("c: / cnbruce")%>
The execution program should be found that the C disk has a multi-CNBRUCE folder, and fso.getBaseName is the extraction folder name. Third, Fso.Deletefolder can establish a folder through the ASP, or the folder can also be deleted. 3, Delfldr.asp
<% Set fso = createObject ("scripting.filesystemObject") fso.deletefolder ("c: / cnbruce") response.write folder has been removed "%>
It is found that the original CNBRUCE folder is indeed deleted. Note that sometimes you need to delete the folder, and the program logic error occurs when the folder does not exist. The status of the folder should be judged first.
<% dir = server.mappath ("cnbruce") set fso = createObject ("scripting.filesystemObject") IF (Fso.FoldRexists (DIR)) Thenfso.Deletefolder (Dir) Response.write ("CNBRUCE folder has been deleted") Elsefso.createFolder (Dir) Response.write ("CNBRUCE folder has been established") end if%> The following uses a general program to flexibly strain. 4, mainflr.asp
<% Sub CreateAFolder (file) Dim fso Set fso = CreateObject ( "Scripting.FileSystemObject") fso.CreateFolder (file) response.write "has established" & fileEnd SubSub DeleteAFolder (file) Dim fso Set fso = CreateObject ( "Scripting. FiLesystemObject ") fso.deletefolder (file) response.write has deleted" & FileEnd Sub%> "& fileEnd Sub%> <% Subname = Request.form (" Submit ") Create = Request.form (" Create ") DEL = Request.form (" Del ") if Subname <>" "" "" & Create & ") End IF Del <>" "" "" "& delity" "" & delate ") end if%>