Add a recursive function to the glob package
Many times I've wanted glob to give me all the "*.zip" or "*.py" or "*.h" files in a directory *and subdirectories* ever since I started using python 7 years ago. I don't know if I'm the only one or not but here's a patch: http://bugs.python.org/issue13968 I'd love to hear feedback on the notion and implementation, Yuval Greenfield
On Wed, Feb 8, 2012 at 9:27 PM, Yuval Greenfield
Many times I've wanted glob to give me all the "*.zip" or "*.py" or "*.h" files in a directory and subdirectories ever since I started using python 7 years ago.
I don't know if I'm the only one or not but here's a patch: http://bugs.python.org/issue13968
I'd love to hear feedback on the notion and implementation,
walkdir [1] is designed to handle that use case and more.
from walkdir import file_paths, filtered_walk paths = file_paths(filtered_walk('.', included_files=['*.py'])) print('\n'.join(sorted(paths))) ./dist/walkdir-0.2.1/build/lib.linux-x86_64-2.7/walkdir.py ./dist/walkdir-0.2.1/docs/conf.py ./dist/walkdir-0.2.1/setup.py ./dist/walkdir-0.2.1/test_walkdir.py ./dist/walkdir-0.2.1/walkdir.py ./docs/conf.py ./setup.py ./test_walkdir.py ./walkdir.py
It's not completely certain yet, but there's a fair chance I'll be adding at least a subset of the walkdir API to shutil in 3.3 (the idea actually started as just adding os.filtered_walk() to shutil, but I moved it to PyPI to give people an opportunity to try out the API. [1] http://walkdir.readthedocs.org -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
participants (2)
-
Nick Coghlan
-
Yuval Greenfield