comparison docs/pycon2010/fileutil.script @ 367:d34f3e8d895f

working out fileutil
author cat@eee
date Thu, 18 Feb 2010 15:15:29 -0500
parents
children 0816cdb5a7db
comparison
equal deleted inserted replaced
366:40cba30b6125 367:d34f3e8d895f
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