Batch Delete bak files using asp

Source: Internet
Author: User

Copy codeThe Code is as follows: <% @ language = vbscript codepage = 936%>
<%
'Batch file automatic search replace inserter Ver2.0
'Write Apsara stack, CSDN account: jspadmin, QQ: 33323489
'Personal website http://www.pifoo.com alimail Chinese site, welcome to exchange links. This site provides free blog Application Registration.
'You can use or modify this code, but please keep the copyright information or link. Thank you for using it!
'Leave me a http://www.pifoo.com/guestbook/ if you have any questions or suggestions
%>
<%
Bakpath = request ("bakpath ")
Delbak = server. mappath (bakpath)
Set fso = createobject ("scripting. filesystemobject ")
Response. write "the deletion result is as follows:" & "<br>"
Iterate (delbak)
Function iterate (path)
Dim folder, folders, files, file
Set folder = fso. getfolder (path)
Set files = folder. files
For each file in files
If fso. getextensionname (file. name) = "bak" then
Response. write file. name & "has been successfully deleted! <Br> "& file. path &" <br>"
File. delete true
End if
Next
Set folders = folder. subfolders
For each f in folders
Iterate f. path
Next
End function
Set fso = nothing
%>
<A href = "index. asp"> back to homepage </A>
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.