Given that you also know you only want dirs, you should be careful that you actually have a dir vs. a file.