With:
currentPath = pathlib.Path.cwd()
I get the current path:
/path/to/my/location/
How can I get the directory location without the need to manually process the complete path?
>Solution :
I’ve linked a duplicate to your question. But if you are asking for pathlib specific solution, use name field:
currentPath = pathlib.Path.cwd().name