Check for filename length instead of truthiness.

Otherwise, if a directory contains a file named '0', we assume no more
files exist (while there could still be any number left)