I have two million text files in a server online accesible to internet users. I was asked to make a change (a string replace operation) to these files as soon as possible. I was thinking about doing a str_replace on every text file on the server. However, I don't want to tie up the server and make it unreachable by internet users.
Do you think the following is a good idea?
<?php ini_set('max_execution_time', 1000); $path=realpath('/dir/'); $objects = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path), RecursiveIteratorIterator::SELF_FIRST); foreach($objects as $name => $object){ set_time_limit(100); //do str_replace stuff on the file }
findandsed. superuser.com/search?q=replace+multiple+files+sed Something along these lines: superuser.com/questions/146389/…xargsexplanation.