Page 1 of 1
Replace in files
Posted: 2010-08-18, 14:17 UTC
by Habilitus
TC has a very cool find files feature (ALT-F7). This dialog also allows finding files with specific content. What I am missing, though, is the feature to replace content in files. Currently I have to use other programs (like Notepad++) to do this.
Posted: 2010-08-19, 13:46 UTC
by ghisler(Author)
I'm sorry, currently this isn't planned: If you apply this by mistake to e.g. Word files, the resulting files will be unusable because of the changed offsets to the formatting information.
Therefore their content would be completely lost. I can recommend that you use an editor (as you already do) with search+replace across documents. This way you can see what you are replacing.
Posted: 2010-08-19, 14:57 UTC
by Habilitus
I understand that this could be a risky operation, so is deleting files. Therefore I always use a file filter (e.g. "*.cpp").
TC should of course warn before actually doing the search&replace operation. Another option (could be disabled/enabled via checkbox) would be to create backup files of those files which need updating in the form of "originalfilepathname".bak. A report at the end of the operation should also list the files which have been touched and how many replacements have been performed.
As I said, it is my most wanted feature which TC is currently lacking.
Posted: 2010-08-19, 15:27 UTC
by karlchen
Hello, Habilitus.
Perhaps another argument not to implement a global search and replace in Total Commander is that this actually means re-inventing the wheel which will require a lot of time and effort:
At minimum a module will be needed which can be compared to the Unix/Linux command sed.
The results of the "sed" operation will have to be displayed in an appropriate Windows like way. We are not on a Unix commandline after all.
Soon there will be requests to allow the user to confirm or deny the changes which the "sed" module is about to perform.
In short words, in the end Christian will be creating and implementing a Total Commander internal text editor which can perform global search and replace operations.
Yet, such text editors do already exist. And a few of them are really powerful.
Just my two and a half cents.
Cheers,
Karl
Posted: 2010-08-19, 15:34 UTC
by Habilitus
@karlchen: I think there is already a powerful search tool available with ALT-F7 (I mentioned it in my first post). This has all the options I need - except replacing the found strings with something else
