rename phrase in content of file with filename

By ptoomen ·
Is it possible to replace a certain phrase in the content of multiple files with the name of that file?
Eg: I have 3 files. the phrase i want to replace inside each file content is "facebook". i want to replace it with the filename at all occurrences. Is it possible? How to do it?

eg: suppose file names are hydrogen.txt, helium.txt, oxygen.txt and all have the following content:
i love facebook. its just great. i love facebook
facebook is awesome.

after the operation, the file "hydrogen.txt" will have the following content
i love hrdrogen. its just great. i love hydrogen
hydrogen is awesome.

number of file i have is actually over a 100

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -


by gechurch In reply to rename phrase in content ...

There is a program called ReNamer that will do this. It's free I think for non-commercial use.

To use it double-click to add a rule (you'll see where). Choose 'Replace' as your rule. In the Find box type in facebook (or whatever). Then click the lightning icon next to the Replace field. This gives you a list of attributes to choose from. Once of them is File_FileName. Choose that and click Add Rule. Now add your files/folders you want to do the replace in I'd suggest doing a preview, and if everything looks ok press Rename.

Related Discussions

Related Forums