Considering we have multiple shutil
functions relying on os.DirEntry
objects, I still think the best option would be to use a scantree
function, even if this were private to begin with (i.e. _scantree
). This keeps us closer to the existing implementation and using Path
objects is higher-level, slower, and introduces pathlib
into shutil
. This feels almost like introducing pathlib
into os.path
itself (okay not quite that bad, but close).
The Path.fwalk
PR looks great to me though, and I’m not completely against using it. scantree
will need some more work in order to be ready.