Use an ASP program to delete a specified file or folder

Source: Internet
Author: User
Program DeleteFolder method<br>
Deletes a specified folder and its contents.<br>
<br>
Object. DeleteFolder folderspec[, Force] <br>
<br>
Arguments <br>
Object<br>
<br>
Required. Always the name of a filesystemobject.<br>
<br>
Folderspec<br>
<br>
Required. The name of the folder to delete. The folderspec can contain wildcard characters in the last path component.<br>
<br>
Force<br>
<br>
Optional. Boolean value is True if folders with the Read-only attribute set are to be deleted; False (default) if they are not.<br>
<br>
Remarks<br>
The DeleteFolder method is does not distinguish between folders that have contents and those. The specified folder is deleted regardless of whether or not it has contents. <br>
<br>
An error occurs if no matching folders are found. The DeleteFolder method is stops on the "the" the "the" it encounters. No attempt is made to roll/undo any changes this were made an error before
<br>
The following example illustrates use of the DeleteFolder method: <br>
<br>
Sub Deleteafolder (filespec) <br>
Dim fso<br>
Set fso = CreateObject ("Scripting.FileSystemObject") <br>
Fso. DeleteFolder (filespec) <br>
End Sub<br>
DeleteFile method<br>
Deletes a specified file.<br>
<br>
Object. DeleteFile filespec[, Force] <br>
<br>
Arguments <br>
Object<br>
<br>
Required. Always the name of a filesystemobject.<br>
<br>
Filespec<br>
<br>
Required. The name of the file to delete. The filespec can contain wildcard characters in the last path component.<br>
<br>
Force<br>
<br>
Optional. Boolean value, is True if files with the Read-only attribute set are to be deleted; False (default) if they are not.<br>
<br>
Remarks<br>
An error occurs if no matching files are found. The DeleteFile method is stops on the "the" the "the" it encounters. No attempt is made to roll/undo any changes this were made an error before
<br>
The following example illustrates use of the DeleteFile method: <br>
<br>
Sub deleteafile (filespec) <br>
Dim fso<br>
Set fso = CreateObject ("Scripting.FileSystemObject") <br>
Fso. DeleteFile (filespec) <br>
End Sub<br>



Related Article

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.