title: Traversing a directory tree bottom-up using Python
body: <p>I would like to find a way to traverse a directory tree in a bottom-up fashion using Python.  The goal would be to find a single directory that would be an unknown distance above or below the current directory.  </p>
  
  <p>I made a diagram that I hope makes my question more clear: 
  <img src="https://i.stack.imgur.com/AJ4AQ.png" alt="Directory Tree"></p>
  
  <p>The red box is the starting point and the green boxes are possible locations of the destination folder, of which only one needs to be found, not both.  </p>
  
  <p>If the destination box is /One/_One/_One, then I would expect the script to go up to /One, then traverse all the way down into /One/_One/_One.  </p>
  
  <p>If the destination folder is /Three, then I would expect the script to do the same as above, and then proceed to /Two and /Two/_Two, not finding it, and then finally reaching /Three. Alternatively, after checking all of /One, it would go to / and then find /Three, skipping the traversal of /Two.</p>
  
  <p>Any help would be appreciated.  I have been looking at all of the os.path and os.walk methods, but haven't found my solution yet.   </p>