for dirname, dirnames, filenames in os.walk("C:\\",followlinks=True,topdown=True):
for subdirname in dirnames:
os.chdir(os.path.join(subdirname, dirname))
if os.getcwd()!="C:\Windows\winsxs":
print(os.getcwd())
As you can see, this code is supposed to search the entire C drive for all subdirectories and change Python's working directory and display the result. I can't help but notice for whatever reason, os.walk has been missing out quite a few subdirectories. It seems to find a big directory tree and then only scan about half of it before moving on (Or at least that's the case with the directories I've checked such as desktop)
I've scoured the net, but I can't seem to find anyone else who has had this problem, some help would be really appreciated (I am a novice coder).
EDIT: The solution worked, but now I get a permission error when I run the code.