How do I search for files and replace strings within them?



Read and add posts to the Visual Basic 6.0 Forums

Download some of my programs and OCXs

Read the Tips here

The old style forum is still available here




From: reena
Date: Wednesday 25 July 2001 12:30 PM
Subject: looping within folder-sub folder-files
Question: martin,
received your reply. but now my problem has changes a bit which is as follows-
i have a folder which contain many folder as well files within it. i want that when i give search-replace critieria it should open the main folder and then open the sub-folder, this sub-folder may contain sub-folder's in it. i want that i can open the files in the sub-sub-folder search for some text in the file and replace it with other text. after finishing this it should go to the next file in the sub-sub-folder and repeat the same search-replace critieria. after doing this , it should return to the next sub-folder in the folder and again repeat the same thing. hope you understand what i mean to say.please reply soon.

Answer by Martin Allen:

I have created a project that will allow you to do this - see project 3 at the Projects page.

When you open the project, you can change the path and filetypes that are searched.

I hope that this will solve your problem.

Martin Allen 1999 - 2011.  Last updated Thursday 11 August 2011 08:49:50 PM +0100.