programming-examples/asp/FilesMaths/Find And Delete.asp

24 lines
609 B
Plaintext
Raw Permalink Normal View History

2019-11-18 14:25:58 +01:00
Const ForReading = 1
Const ForWriting = 2
Set fso = Wscript.CreateObject("Scripting.FileSystemObject")
Set folder = fso.GetFolder("d:inetpubwwwroot")
Set files = folder.files
varText = "Script that you want to delete"
For Each f1 In files
If InStr(f1,".asp") > 0 Or InStr(f1,".htm") > 0 Or InStr(f1,".html") > 0
Then
Set f = fso.OpenTextFile(f1,ForReading)
If Not f.AtEndOfStream Then
varNew = Replace(f.ReadAll,varText,"")
Set f = fso.OpenTextFile(f1,ForWriting )
f.Write varNew
End If
Set f = Nothing
End If
Next
MsgBox "Change OK"