How to split one text file into multiple text files according to text content?

Hi,

Currently, I generated text file & create this folder:
\2022 Nov\20221115 based on the date in text file:
image

But if i have another date in another text file:
image
How to create add \20221129 in folder at \2022 Nov?

so it will become like this:
image