Mercurial > python-cmd2
comparison docs/pycon2010/fileutil.py @ 369:bc4b956d57b6
added run to py
author | cat@eee |
---|---|
date | Thu, 18 Feb 2010 16:13:10 -0500 |
parents | docs/pycon2010/fileutil.script@0816cdb5a7db |
children | cd25e114fbc1 |
comparison
equal
deleted
inserted
replaced
368:0816cdb5a7db | 369:bc4b956d57b6 |
---|---|
1 import os | |
2 import os.path | |
3 | |
4 for (dirpath, dirnames, filenames) in os.walk('/home/cat/proj/sqlpython/sqlpython'): | |
5 for fname in filenames: | |
6 fullfilename = os.path.join(dirpath, fname) | |
7 stats = os.stat(fullfilename) | |
8 binds['path'] = dirpath | |
9 binds['name'] = fname | |
10 binds['bytes'] = stats.st_size | |
11 cmd("""INSERT INTO cat.files (path, name, bytes) | |
12 VALUES (%(path)s, %(name)s, %(bytes)s)""") | |
13 quit() |