It was a for loop for 2 passes; I changed it to a while loop which updates max number of passes based on the max_depth encountered. This should prevent the need to iterate a third and fourth time looking for directory paths with more than 100 directories in the path, which I suspect will be rare if at all extant. That's the code l.684ff