stop reading dir if folder is not valid