Skip to content

Instantly share code, notes, and snippets.

@OterLabb
Created June 10, 2018 08:22
Show Gist options
  • Save OterLabb/35eb4d7f891e4c2dd56ac0bcff34103b to your computer and use it in GitHub Desktop.
Save OterLabb/35eb4d7f891e4c2dd56ac0bcff34103b to your computer and use it in GitHub Desktop.
Make a list of all jpg files in a folder
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