I have a path. Could be path to a file, could be path to a directory.
Now I need to delete the file (if it is a path to a file) and then check if there’s no more files in the same folder, delete it as well, and then check the parent folder and so on.
if it is a path to a directory, delete directory, and then check if the parent is empty – delete it as well, and then its parent and so on.
I guess by combining these possible to build something: