I want to add our company's copyright information to all of our EXISTING source code files.
The project is developed in Eclipse
. so, for new files I can modify the settings as suggested here. But for existing files, how am I supposed to do this. How can I modify hundreds of java files to add the copyright information. (And I'm unable to open the releng plugin mentioned in the above link.
Any windows based text maniputaion scripting language will also help.
Please try eclipse Releng plugin.
This would help to fix/add copyright statement in all .java files and .properties.
Simply right click on the project and select "Fix copyright".
Link.
Talk your boss out of it.
See Get Rid of Source Code Templates.
You can use maven license plugin to do this.
Check this and this. The plugin support templates for your license header, remove the license and check for the license in all your files.
I would install CygWin (core + find) and do something of a kind
find . -name *.java -exec mv '{}' tmp && cp copyright '{}' && cat tmp >> '{}' && rm tmp \;
Correcting Konstantin's solution:
Problem was that && is being interpreted by the shell directly instead of being passed to find. Escaping them is no solution either, as the find exec does not understand them. So just give the whole command to some shell.
I think you can use Eclipse replace command using Regular Expression.
Imagine that your copyright is something like:
then
Explanation of regex:
\A - Start of the file
\Q...\E - Here goes the regex keywords ( because / and * are keys in regex )
\s+ - whitespaces
[^(..)] - means except