Ask coding questions

← Back to all posts
os.walk() is not able to pick up all the directories
unrealhuman (0)

p=input("path::")
exclude="LOGS"
for root, dirs, files in os.walk(p):
for dir in dirs:
dirs[:] = [d for d in dirs if d not in exclude]
if (dir.endswith("simv.vdb")):
result.append(os.path.realpath(os.path.join(root,dir)))

in a folder of 2000 files i was able to pick up only 1400 around files. can please someone check whether i need any up-gradation in code. I am Python version 3.6

Comments
hotnewtop
IanAylward (0)

u need to do

before the code

CodeLongAndPros (1644)

Please link to the relevant repl in your post.