Refactor dirToFiles
Skip symbolic links on POSIX platforms