| This took about 10 minutes to create. Copy this into a file called
"Edit-HTTrack-Comments.vbs", you can use Notepad.
' for /R J:\Temporary %f in (*.htm) do "N:\Edit-HTTrack-Comments.vbs" "%f"
' DOS command line...
' setup some constants...
Const ForReading = 1, ForWriting = 2, ForAppending = 8
' dimension some variables...
Dim fso, f, FileText, FileName
'msgbox WScript.Arguments.item(0),, "Da File"
' get the argument passed to the script...
FileName = WScript.Arguments.item(0)
' create the file system object, then open the file for reading...
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(FileName, ForReading, True)
' read the entire contents into a variable...
FileText = f.ReadAll
' all done close the file
f.close
set f = nothing
' now make the edits from the text of the old file, to the new text...
on error resume next ' necessary just in case a file doesn't contain
comments, should be ignored
dim spos, epos, comment
spos = InStr(1, FileText, "<!-- Mirrored from") ' Find the initial comment
epos = InStr(spos, FileText, "-->") ' Find the end of the comment
comment = Mid(FileText, spos, epos-spos+3)
FileText = Replace(FileText, comment, "") ' replace the comment with blank
string
'msgbox comment,,"Comment"
' write the new contents, close up and go home...
Set f = fso.OpenTextFile(FileName, ForWriting, True)
f.WriteLine FileText
f.close
set f = nothing
set fso = nothing
'> | |