Mercurial > python-cmd2
annotate docs/pycon2010/fileutil.script @ 368:0816cdb5a7db
fix quit() in py
author | cat@eee |
---|---|
date | Thu, 18 Feb 2010 15:35:36 -0500 |
parents | d34f3e8d895f |
children |
rev | line source |
---|---|
368 | 1 set echo on |
2 py | |
367 | 3 import os |
4 import os.path | |
5 | |
6 for (dirpath, dirnames, filenames) in os.walk('/home/cat/proj/sqlpython/sqlpython'): | |
7 for fname in filenames: | |
8 fullfilename = os.path.join(dirpath, fname) | |
9 stats = os.stat(fullfilename) | |
10 binds['path'] = dirpath | |
11 binds['name'] = fname | |
12 binds['bytes'] = stats.st_size | |
13 cmd("""INSERT INTO cat.files (path, name, bytes) | |
14 VALUES (%(path)s, %(name)s, %(bytes)s)""") | |
368 | 15 quit() |