You should check you can read a dir, and it exists before attempting to use