Last active
February 7, 2019 19:43
-
-
Save tonjadwyer/8c6a88c8fd9a981ac14c64cd0bb25421 to your computer and use it in GitHub Desktop.
python walk directory to list (thispointer.com)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# puts all file paths in filelist | |
# puts all folders in dirlist | |
filelist = [] | |
dirlist = [] | |
for (dirpath,dirnames,filenames) in os.walk('my\path\to\walk'): | |
filelist += [os.path.join(dirpath,file) for file in filenames] | |
dirlist += dirnames |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment