Replace in files

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
Habilitus
Junior Member
Junior Member
Posts: 3
Joined: 2010-08-18, 14:12 UTC

Replace in files

Post 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.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50541
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post 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.
Author of Total Commander
https://www.ghisler.com
Habilitus
Junior Member
Junior Member
Posts: 3
Joined: 2010-08-18, 14:12 UTC

Post 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.
User avatar
karlchen
Power Member
Power Member
Posts: 4605
Joined: 2003-02-06, 22:23 UTC
Location: Germany

Post 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
Habilitus
Junior Member
Junior Member
Posts: 3
Joined: 2010-08-18, 14:12 UTC

Post 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 ;-)
Post Reply