addcopyright

add copyright information to an m-file or group of m-files.
2.8K Downloads
Updated 21 Aug 2009

View License

Editor's Note: This file was selected as MATLAB Central Pick of the Week

ADDCOPYRIGHT(TARGET,UPDATE,YEAR_OR_STRING,ORG,INFODISP)
ADDCOPYRIGHT adds or modifies the copyright info to an M-file or all M-files in a designated folder as well as subfolders.

This program was originally written by Raymond Norris and has been modified to add additional features summarized below.

The copyright line that is built up looks like the following:
% Copyright <YEAR> <ORGANIZATION>
The copyright info is placed directly above the Revision line(containing "$Revision") or after the first blank line that is not commented after the first commented section.

The program may be invoked in a variety of ways and options, please see the comment section for details. For example one common syntax is
ADDCOPYRIGHT '' T
which calls up a dialog box to select the directory and updates the copyright info in the selected folder and all subfolders.

The following summarizes some of the differences between the original version and this version.
1. Argument list order is changed, and number of arguments is reduced.
2. Command line syntax is supported.
3. If folder argument is empty, a dialog box selects the folder.
4. Copyright info may be added to a single file.
5. Copyright info is added either before $Revision keyword or after a blank line.
6. Number of spaces between % and Copyright are now immaterial.
7. The organization is checked and if different a new copyright line is added.
8. A Def_organization constant is added.
9. Will not attempt to add copyright info to contents.m or files that are not M-files.
10. If copyright_string is blank and update is true then copyright line is deleted.
11. The correct eol character for the OS is used to rewrite the files.
12. More file checks are performed to prevent leaving temporary files.
13. Summary output to command line has been changed to be easier to read.
14. Added features to work with range of years as specified by year1-year2.

Please send me an email if you find this program useful, find bugs, or have recommendations.

Cite As

Mirko Hrovat (2024). addcopyright (https://www.mathworks.com/matlabcentral/fileexchange/16441-addcopyright), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2007b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Categories
Find more on Data Type Identification in Help Center and MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.4.0.0

This update: reverses the meaning of the empty string, '', prior version used ' ' to mean empty, added a function to get a list of all m-files before modifying them, added an INFODISP argument, and modified EOL character to be based on the OS.

1.1.0.0

updated copyright and licensing information

1.0.0.0