fso| Skills
After the drive is finished, the folder is then manipulated. These include extracting folder information, creating folders, deleting folders, copying folders, moving folders, and so on. Here's a concrete look.
first, FSO. GetFolder
A look is clear, is the extraction folder. Which folder is that specifically extracted? Definitely follow the path to a folder. Extract it and then display the information about the folder? Whether there is to be specific extraction down. 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 & "<br>"
If Fldr. IsRootFolder = True Then
Response.Write "This folder is a folder" & "<br>"
Else
Response.Write "This folder is not a root folder" & "<br>"
End If
Response.Write "Drive name is:" & Fldr. Drive & "<br>"%>
It is essential to establish a connection to the FSO component first, then set Fldr = FSO. GetFolder ("C:\Program Files") sets the Fldr object to be assigned as a reference to the following program.
Fldr. IsRootFolder is to determine whether the folder is a folder and the value is a Boolean (true or false); Fldr. Drive displays the drive letter for the folder.
Second, FSO. CreateFolder
The next more exciting is the creation of a folder through ASP, you can create any folder within your jurisdiction.
2,creatfldr.asp
<%set fso = CreateObject ("Scripting.FileSystemObject")
Fso. CreateFolder ("C:\cnbruce")
Response.Write "folder name is" & FSO. Getbasename ("C:\cnbruce")%>
Execution procedures, should find C disk more out of the Cnbruce folder, FSO. Getbasename is the extraction folder name.
third, FSO. DeleteFolder
You can create a folder from ASP, and you can also delete the folder.
3,delfldr.asp
<%set fso = CreateObject ("Scripting.FileSystemObject")
Fso. DeleteFolder ("C:\cnbruce")
Response.Write "folder deleted"%>
It is found that the Cnbruce folder that you just created has actually been deleted.
The following is a general procedure for flexible response.
4,mainflr.asp
<%sub createafolder (file)
dim FSO
set FSO = CreateObject ("Scripting.FileSystemObject")
fso. CreateFolder (file)
response.write has established the &file
end Sub
sub Deleteafolder (file)
dim FSO
set fso = CreateObject ("Scripting.FileSystemObject")
fso. DeleteFolder (file)
response.write has deleted the &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= Set up "Name=" >
</form>
<form action= " Mainflr.asp "method=" POST "><input name=" del ">
<input type=" Submit "value=" Delete "Name=" Submit ">
</form>
Note that deleting does not prompt "confirm that you want to put in the Recycle Bin." This is something you need to be cautious about, especially for your system folders.