breadth first search for directories