To avoid iterating through this list multiple times, can you add both of these conditions to the single list comprehension? That would look like:
```
file_names = [fname for fname in file_names if not fname.startswith('.') and not os.path.isfile(fname)]
```