I have a column with a folder path structure
root01/folder01/sub-folder
root01/folder2/subfolder
root2/folder01/anothersub/evenmore
root2/folder400/anothersub
Ideally I'd like a query that would return the 2nd to last folder, like
folder01
folder2
anothersub
folder400
I'd also be happy with the path, up to the last level
root01/folder01
root01/folder2
etc...