Folder with ASP

xiaoxiao2021-03-06  15

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.ISROTFOLDER = TRUE THEN RESPONSE.WRITE "This folder is a folder" & "
" Else Response.write "This folder is not root folder" & "
"End ifresponse.write" drive name is: "& fldr.drive &"
"%> The connection to build FSO components is essential, then set fldr = fso.getFolder (" C: / Program Files ") Set 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") %> Execute the program, you should find that the C disk has a CNBRUCE folder, and fso.getBaseName is an extracting 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"%> Discover the original CNBRUCE folder is indeed delete. Then use 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 "deleted" & FileEnd Sub%> <% Subname = Request.form ("Submit") Create = Request.form ("Create") DEL = Request.form ("DEL") if Subname <> "" "" "& CREATE &" "" "& Create &" "" "& del") end if End IF%>


need to pay attention What is deleted does not prompt "Confirm to put into the recycle bin". This requires careful handling, especially for your system folder. Fourth, the main role of fso.movefolder is the movement of the folder, which is equivalent to cutting and paste actions. 5, movefldr.asp <% set fso = createObject ("scripting.filesystemObject") fso.createfolder ("c: / cnbruce") fso.movefolder "c: / cnbruce", "C: / Program files /"%> < A href = "c: / program files /"> Viewing the CNBRUCE folder Is there a mobile format: fso.movefolder "Moved folder", "Mobile to folder" this program is first in C The CNBRUCE folder is established and then moves it below the C: / Program Files / folder. However, it is also necessary to pay attention to your system folder can't move.

转载请注明原文地址:https://www.9cbs.com/read-46209.html

New Post(0)