Elements of Filepath for Tags

Does this entry from the FAQ answer your question?

How to import parts of the folder structure into the tag (Directory to Tag)