Skip to content

Instantly share code, notes, and snippets.

View jasonpierrepont's full-sized avatar

Jason Pierrepont jasonpierrepont

View GitHub Profile
@jasonpierrepont
jasonpierrepont / scantree.py
Last active October 8, 2022 23:19
Python os.walk with DirEntry results instead of path strings. If not using python 3.5+ you'll need to have the scandir package installed. Currently, this is a simple implementation and does not fully replicate the functionality of os.walk.
try:
from os import scandir
except ImportError:
from scandir import scandir
def scantree(path):
subs = []
files = []
for entry in scandir(path):