Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Process all .cpp and .h files under the directory tree at $PROJECTROOT
- # To add other file types, add more "-o -name *.ext" clauses.
- # $COPYRIGHTFILE is the file containing your copyright message
- COPYRIGHTLENGTH=$(wc -l $COPYRIGHTFILE)
- for file in $(find $PROJECTROOT -name *.cpp -o -name *.h); do
- if diff <(head -n $COPYRIGHTLENGTH $file) $COPYRIGHTFILE; then
- (cat $COPYRIGHTFILE; cat $file) > /tmp/file
- mv /tmp/file $file
- fi
- done
- 1: static void Main(string[] args)
- 2: {
- 3: string path = "C:\...TopLevelFolder";
- 4: string copyright = "//Copyright © 2011 Rex Cardan, Ph.D";
- 5: string[] files = Directory.GetFiles(path, "*.cs",
- 6: SearchOption.AllDirectories);
- 7: foreach (string file in files)
- 8: {
- 9: if (file.Split('\')[file.Split('\').Length-1]!= "AssemblyInfo.cs")
- 10: {
- 11: using (StreamWriter sw = File.AppendText(file))
- 12: {
- 13: sw.WriteLine("rn");
- 14: sw.WriteLine(copyright);
- 15: //Normalize Line Endings
- 16: sw.WriteLine("rn");
- 17: }
- 18: }
- 19: }
- 20: }
Add Comment
Please, Sign In to add comment