Plugin which automatically uses the Path from Parent vault to tag with folder name

I would love a plugin which manages to tag my notes on save. I imagined it like follows:
I have my Path …/TopLevelVault/Folder1/Folder2/… and a script reads all the subfolders from the main vault directory on an adds the corresponding tag to the note. In this example #Folder1, #Folder2.
I hope I communicated my idea in a stringent manner^^