import os
import numpy as np
myimages = [] #list of image filenames
dirFiles = os.listdir('.') #list of directory files
dirFiles.sort() #good initial sort but doesnt sort numerically very well
sorted(dirFiles) #sort numerically in ascending order
for files in dirFiles: #filter out all non jpgs
if '.jpg' in files:
myimages.append(files)
print len(myimages)
print myimages