Skip to content

How to update copyright years

Miroslav Bajtoš edited this page Jan 5, 2018 · 3 revisions

In order to automatically update copyright years in all source file headers, run the following command on a Unix machine (macOS, Linux). Make sure to replace the old year and the new year with current values.

LC_CTYPE=C && LANG=C && find . -not \( -path ./.git -prune \) -type f -exec sed -i '' s/Copyright\ IBM\ Corp.\ 2014,2016./Copyright\ IBM\ Corp.\ 2014,2018./ {} +

Note: On OSX, sed adds a newline char at end of files that are missing it. This is why the png, json, and ejs files show changes. This can be prevented with additional "not" if needed (e.g. -not \( -path *.png -prune \))

Clone this wiki locally