Skip to content
WJunction - Webmaster Forum

Changing A Word in More Than 10 Txt Files at Same Time

Status
Not open for further replies.
Hi,

I need a script or a way to change a word in more than 10 txt files at same time. Forexample :

I have 120 different txt files in a folder. And there is "TEST1" word in all txt files. And I want to change "TEST1" word to "TEST2". I want to do this in all txt files at same times.

Is there any way or any script to do that?

Thanx for now...
 

10 comments

Hi,

I need a script or a way to change a word in more than 10 txt files at same time. Forexample :

I have 120 different txt files in a folder. And there is "TEST1" word in all txt files. And I want to change "TEST1" word to "TEST2". I want to do this in all txt files at same times.

Is there any way or any script to do that?

Thanx for now...
Paid or Free?? :|
 
If it's a once off thing then as said above just install notepad open the file and do a CTRL + F (which is find) and click on the Replace tab. enter what you want to change it to and then click Replace All.


Otherwise if they are files on your server you can do something like the following in php
  • open the folder
  • put all files in the folder into an array
  • start a loop for each of the files found
  • open each of the files in the loop
  • using str_replace("TEST1", "TEST2", $content) to change text
  • close loop
We need more info. Are the files on your computer or your server and is this a once off thing or do you need it don regularly.

EDIT: NM problem is solved with first suggestion :)
 
Status
Not open for further replies.

About the author

A
Active Member · Joined
203
Messages
17
Reactions
18
Points

Advertise on WJunction

Reach 1000's of webmasters, hosts & affiliates. Banner & sponsored-thread slots available.

Contact us
Back
Top Bottom