' Bulk Find and Replace
'
'
Find = "xxxx"
ReplaceWith = "yyyy"
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Read source text file
Set objInputFile = objFSO.OpenTextFile("input.txt",1)
Do While Not objinputfile.AtEndOfStream
' Get the name of file to check from input.txt
StrFile = objInputFile.ReadLine
' Open that file for reading and replace the text
Set objInputFile2 = objFSO.OpenTextFile(StrFile,1)
StrData = objInputFile2.ReadAll
StrOutput = Replace(StrData,find,replacewith)
objInputFile2.Close
' ReWrite the file with the replaced text
Set objInputFile2 = objFSO.OpenTextFile(StrFile,2)
objInputFile2.Writeline StrOutput
objInputFile2.Close
Loop
No comments:
Post a Comment