add if as osx doesn't have dir