in reply to finding a subdir

Make sure you prepend the dir when using readdir
grep { -d "$dir/$_" } readdir $dh;