Message145999
I needed a depth-limited, filtered search of a directory tree recently and came up with the following wrapper around os.walk that brings in a few niceties like glob-style filtering, depth limiting and symlink traversal that is safe from infinite loops. It also emits a named tuple rather than the bare tuple emitted by os.walk:
http://code.activestate.com/recipes/577913-selective-directory-walking/
I think this would make a nice addition to 3.3 as shutil.filter_walk, but it need tests, documentation and reformatting as a patch before it can go anywhere. |
|
Date |
User |
Action |
Args |
2011-10-20 02:05:30 | ncoghlan | set | recipients:
+ ncoghlan |
2011-10-20 02:05:30 | ncoghlan | set | messageid: <1319076330.7.0.757546324527.issue13229@psf.upfronthosting.co.za> |
2011-10-20 02:05:30 | ncoghlan | link | issue13229 messages |
2011-10-20 02:05:29 | ncoghlan | create | |
|