# HG changeset patch # User cat@eee # Date 1266528030 18000 # Node ID cd25e114fbc1f0e1b205b19a210510922abc727e # Parent bc4b956d57b60acfc41ed057217a5caa8cc07635 shorter fileutil diff -r bc4b956d57b6 -r cd25e114fbc1 docs/pycon2010/fileutil.py --- a/docs/pycon2010/fileutil.py Thu Feb 18 16:13:10 2010 -0500 +++ b/docs/pycon2010/fileutil.py Thu Feb 18 16:20:30 2010 -0500 @@ -1,13 +1,12 @@ -import os +import glob 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() +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()