def walk_up(bottom):
    "Mimic os.walk, but walk 'up' instead of down the directory tree.\n    From: https://gist.github.com/zdavkeos/1098474\n    "
    bottom = os.path.realpath(bottom)
    try:
        names = os.listdir(bottom)
    except Exception:
        return
    (dirs, nondirs) = ([], [])
    for name in names:
        if os.path.isdir(os.path.join(bottom, name)):
            dirs.append(name)
        else:
            nondirs.append(name)
    (yield (bottom, dirs, nondirs))
    new_path = os.path.realpath(os.path.join(bottom, '..'))
    if (new_path == bottom):
        return
    for x in walk_up(new_path):
        (yield x)
Mimic os.walk, but walk 'up' instead of down the directory tree.
From: https://gist.github.com/zdavkeos/1098474
def walk_up(bottom):
    "Mimic os.walk, but walk 'up' instead of down the directory tree.\n    From: https://gist.github.com/zdavkeos/1098474\n    "
    bottom = os.path.realpath(bottom)
    try:
        names = os.listdir(bottom)
    except Exception:
        return
    (dirs, nondirs) = ([], [])
    for name in names:
        if os.path.isdir(os.path.join(bottom, name)):
            dirs.append(name)
        else:
            nondirs.append(name)
    (yield (bottom, dirs, nondirs))
    new_path = os.path.realpath(os.path.join(bottom, '..'))
    if (new_path == bottom):
        return
    for x in walk_up(new_path):
        (yield x)