How to get only files in directory?

"If you need a list of filenames that all have a certain extension, prefix, or any common string in the middle, use glob instead of writing code to scan the directory contents yourself"

import os
import glob

[name for name in glob.glob(os.path.join(path,'*.*')) if os.path.isfile(os.path.join(path,name))]

You can use os.path.isfile method:

import os
from os import path
files = [f for f in os.listdir(dirToScreens) if path.isfile(f)]

Or if you feel functional :D

files = filter(path.isfile, os.listdir(dirToScreens))