Skip to content

Instantly share code, notes, and snippets.

@Kyu
Created January 2, 2018 10:26
Show Gist options
  • Save Kyu/682ea72c22c8636e7bd92fe0afae9a39 to your computer and use it in GitHub Desktop.
Save Kyu/682ea72c22c8636e7bd92fe0afae9a39 to your computer and use it in GitHub Desktop.
Outputs all file names in dir to file
import os
path = os.getcwd()
for root, dirs, files in os.walk(path):
with open('names.txt', 'w') as f:
f.writelines([i +'\n' for i in files])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment