only check listdir on dirs

is_hidden is called with files, not just dirs