Throw a better error message if attempting to access a directory without...

this commit will give a better IO Exception message if the user attempts to access a directory without permission.