Added defense against directories in the logs dir.