import os
with open("dumb.txt", "w") as f:
for dirpath, dirnames, filenames in os.walk("C:"):
for file in filenames:
f.write(os.path.join(dirpath, file) + "\n")