diff options
author | Zearin <zearin@gonk.net> | 2011-12-30 12:30:54 -0500 |
---|---|---|
committer | Zearin <zearin@gonk.net> | 2011-12-30 12:30:54 -0500 |
commit | e8c7d7a4de0c6cb8cf6760d4d07bd8001455b18d (patch) | |
tree | 572a6d18ac4385ac73aa319695a7e16e7c62e81b /docs/pycon2010/fileutil.py | |
parent | 4ad50dbd97d27717c7307597e0349e767ccd880a (diff) | |
download | cmd2-feature/refactor.tar.gz |
Move documentation to top-level.feature/refactor
Following the examples I’ve seen in other Python projects.
Diffstat (limited to 'docs/pycon2010/fileutil.py')
-rw-r--r-- | docs/pycon2010/fileutil.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/docs/pycon2010/fileutil.py b/docs/pycon2010/fileutil.py new file mode 100644 index 0000000..5e754b5 --- /dev/null +++ b/docs/pycon2010/fileutil.py @@ -0,0 +1,12 @@ +import glob +import os.path + +for fullfilename in glob.glob('/home/cat/proj/cmd2/*.py'): + (dirpath, fname) = os.path.split(fullfilename) + stats = os.stat(fullfilename) + binds['path'] = dirpath + binds['name'] = fname + binds['bytes'] = stats.st_size + cmd("""INSERT INTO cat.files (path, name, bytes) + VALUES (%(path)s, %(name)s, %(bytes)s)""") +quit() |