Created
July 8, 2016 14:32
-
-
Save IntegersOfK/bc2f1109ffc04d78ace89b7a44ab8f3e to your computer and use it in GitHub Desktop.
Simple python script to make a list of all the filenames in a particular folder tree.
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
import os | |
with open('output.txt', 'w') as a: | |
for path, subdirs, files in os.walk('/folder/with/files'): | |
for filename in files: | |
filestr = str(filename) | |
if filestr.endswith('.htm') or filestr.endswith('.html'): | |
print(filename) | |
a.write(str(filename) + ',') #separate by comma | |
else: | |
print('Skipping non html or htm file:' + filestr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment