annotate docs/pycon2010/fileutil.py @ 426:05a44bf4b449

delete pdb
author catherine.devlin@gmail.com
date Thu, 28 Jul 2011 01:13:46 -0400
parents e84703583996
children
rev   line source
370
cd25e114fbc1 shorter fileutil
cat@eee
parents: 369
diff changeset
1 import glob
367
d34f3e8d895f working out fileutil
cat@eee
parents:
diff changeset
2 import os.path
d34f3e8d895f working out fileutil
cat@eee
parents:
diff changeset
3
370
cd25e114fbc1 shorter fileutil
cat@eee
parents: 369
diff changeset
4 for fullfilename in glob.glob('/home/cat/proj/cmd2/*.py'):
371
e84703583996 ha, new 0.6.0
cat@eee
parents: 370
diff changeset
5 (dirpath, fname) = os.path.split(fullfilename)
370
cd25e114fbc1 shorter fileutil
cat@eee
parents: 369
diff changeset
6 stats = os.stat(fullfilename)
cd25e114fbc1 shorter fileutil
cat@eee
parents: 369
diff changeset
7 binds['path'] = dirpath
cd25e114fbc1 shorter fileutil
cat@eee
parents: 369
diff changeset
8 binds['name'] = fname
cd25e114fbc1 shorter fileutil
cat@eee
parents: 369
diff changeset
9 binds['bytes'] = stats.st_size
cd25e114fbc1 shorter fileutil
cat@eee
parents: 369
diff changeset
10 cmd("""INSERT INTO cat.files (path, name, bytes)
cd25e114fbc1 shorter fileutil
cat@eee
parents: 369
diff changeset
11 VALUES (%(path)s, %(name)s, %(bytes)s)""")
cd25e114fbc1 shorter fileutil
cat@eee
parents: 369
diff changeset
12 quit()