Skip to content

Instantly share code, notes, and snippets.

@bebraw
Created September 13, 2012 15:55
Show Gist options
  • Save bebraw/3715292 to your computer and use it in GitHub Desktop.
Save bebraw/3715292 to your computer and use it in GitHub Desktop.
Tiny licensifier script
#!/usr/bin/env python
import os
def walk(path, extensions, cb):
path = os.path.abspath(path)
for f in os.listdir(path):
fp = os.path.join(path, f)
p, ext = os.path.splitext(f)
if ext[1:] in extensions:
cb(f)
if os.path.isdir(fp):
walk(fp, extensions, cb)
if __name__ == '__main__':
def cb(path):
print 'Writing ' + path
with open(path, 'w') as f:
pass # TODO: prepend license block here
walk('./src', ['c', 'h'], cb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment