removing nonexisting dirs from path