Fix directory filtering to not skip entries
Compare changes
Directory filtering code in fs.py was accidentally skipping the entry immediately following a filtered entry; modifying the iterable during iteration has unwanted effects.
Closes: #1056291