Created
June 10, 2018 08:22
-
-
Save OterLabb/35eb4d7f891e4c2dd56ac0bcff34103b to your computer and use it in GitHub Desktop.
Make a list of all jpg files in a folder
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 | |
files = [f for f in os.listdir('.') if os.path.isfile(f)] | |
cwd = os.getcwd() | |
text_file = open("images.txt", "w") | |
print("Writing to text file") | |
for f in files: | |
if "jpg" in f: | |
text_file.write(cwd + "\\" + f + '\n') | |
#text_file.close() | |
print("Done writing") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment