Centralize dot (.) prefix check, applying to both files and directories.