Wednesday, December 14, 2011

Deleting files, keeping a few -- in Python

And the same again, only as a script, just because:

If there wasn't that comparison function to write, it'd be terser...


1 comment:

  1. Changing fcompare to:

    fcompare = lambda x,y: cmp(os.path.getmtime(x), os.path.getmtime(y))

    makes it a two-liner...

    ReplyDelete