I have a directory with a bunch of files inside:
You can't exclude patterns with the
glob function, globs only allow for inclusion patterns. Globbing syntax is very limited (even a
[!..] character class must match a character).
You'll have to do your own filtering; a list comprehension usually works nicely here:
files = [fn for fn in glob('somepath/*.txt') if not os.path.basename(fn).startswith('eph')]