Scandir is a faster implementation of os.listdir since it caches file metadata
as it works. Using listdir and then calling things like os.path.isfile after
the fact will result in multiple system calls. Whereas with scandir, there will
only be a single system call per file.
Scandir is part of the stdlib in Python 3.6+, so the following can be used for
Python 2/3 compatible code:
try
from os import scandir, walk
except ImportError:
from scandir import scandir, walk
Differential Revision: https://phabricator.services.mozilla.com/D7738
--HG--
extra : moz-landing-system : lando