Mercurial > python-cmd2
view 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 |
line wrap: on
line source
set echo on py import os import os.path for (dirpath, dirnames, filenames) in os.walk('/home/cat/proj/sqlpython/sqlpython'): for fname in filenames: fullfilename = os.path.join(dirpath, fname) 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()