Find and Replace in multiple files
Find and replace text strings in multiple files within a directory. This allows for wilcards. Please Vote if you like it! :)
Rate Find and Replace in multiple files
(3(3 Vote))
Dim strFind As String
Dim strReplace As String
Dim strDestination As String
Dim strSource As String
Dim strFilter
strFind = "Hello" 'What to find
strReplace = "Goodbye" 'What to replace it with
strDestination = "c:\temp" 'Where to put the files once they have been modified
strSource = "c:\output" 'Where to get the files
strFilter = "*.txt" 'wildcards
'verification complete
Dim parse As String
Dim hold As String
'FIND AND REPLACE
sdir = Dir(strSource & "\" & fMainForm.txtIncludeFilter)
Do While sdir <> ""
Open fMainForm.txtSource & "\" & sdir For Input As #1
Do While Not EOF(1)
Line Input #1, parse
hold = hold & Replace(parse, fMainForm.txtReplace, fMainForm.txtFind)
Loop
Loop
Open fMainForm.txtSource & "\" & sdir For Output As #1
Print #1, hold
Close #1
hold = ""
parse = ""
sdir = Dir()
Loop
Find and Replace in multiple files Comments
No comments yet — be the first to post one!
Post a Comment