Introduction to ASP Programming (2): Operation of the FSO component folder

Source: Internet
Author: User

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 "父文件夹名字是:" & fldr & "<br>"
If fldr.IsRootFolder = True Then
  Response.Write "该文件夹是一根文件夹" & "<br>"
Else
  Response.Write "该文件夹不是根文件夹" & "<br>"
End If
Response.Write "驱动器名字是:" & 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 "文件夹名为" & 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 "文件夹已删除"
%>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.