I agree that @state and @event_queue are already defined in dir_stat if exists. I will remove the settings.
But the recursive call should continue to propogate in the tree to create the new dirs(optinal) and file.
Concider these 2 paths:
/dir1/dir2/file - this will reate dir 1, dir 2 and file
/dir1/dir2/dir3/file - this will create only dir 3 and file. At dir1 and dir2, it will only do the recursive call to travel the tree