Created
September 13, 2012 15:55
-
-
Save bebraw/3715292 to your computer and use it in GitHub Desktop.
Tiny licensifier script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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