view docs/pycon2010/fileutil.py @ 380:de2306847251

replacing temporaryfile with an object seems good
author cat@eee
date Mon, 22 Feb 2010 21:26:40 -0500
parents e84703583996
children
line wrap: on
line source

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()