Handle gracefully when the directory passed is invaid (not a directory or nonexistent).