将标题(版权)信息添加到现有的源文件 [英] Add header(copyright) information to existing source files

查看:114
本文介绍了将标题(版权)信息添加到现有的源文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想将我们公司的版权信息添加到我们所有的EXISTING源代码文件中。

I want to add our company's copyright information to all of our EXISTING source code files.

该项目是在 Eclipse 中开发的。因此,对于新文件,我可以根据建议修改设置此处。但是对于现有的文件,我该怎么做呢如何修改数百个java文件来添加版权信息。 (和我无法打开上述链接中提到的releng插件。

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.

任何基于Windows的文本操纵脚本语言也将有所帮助。

Any windows based text maniputaion scripting language will also help.

推荐答案

更正Konstantin的解决方案:

Correcting Konstantin's solution:

find . -name \*.java -exec sh -c "mv '{}' tmp && cp copyright '{}' && cat tmp >> '{}' && rm tmp" \;

问题是由shell直接解释而不是被传递到查找逃避它们也不是解决方案,因为find exec不明白他们,所以只需把整个命令给一些shell。

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.

这篇关于将标题(版权)信息添加到现有的源文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆