I know that to go up to a parent directory, you should use
parentname = os.path.abspath(os.path.join(yourpath, os.path.pardir))
But what if I want to get the name of a directory a few folders up?
Say I am given /stuff/home/blah/pictures/myaccount/album, and I want to get the names of the last two folders of “myaccount” and “album” (not the paths, just the names) to use in my script. How do I do that?
etc…