Creating a rename present based on start of parent folder

Hello, I'm trying to import thousands of home videos within Plex, which requires a certain naming structure, so they show up correctly. Basically my files need to be within a folder, subfolder and named with SXXEXX - Filename.

Each of my home videos are organized within the correct folder structure, but the filename isn't. Is there anyway to make a rename script that will rename all files based on the parent name?

For example

  • Christmas > Season 01 > 01 Opening first present.mp4
  • Christmas > Season 36 > 9 Decorating tree.mkv

I need to rename the filename to

  • S01E01 - Opening the first present.mp4
  • S36E09 - Decorating tree.mkv

Most files are already numbered, but even if they're not, I can number pretty easily. I just need to figure out how to extract the Season ## from the folder name to input it within every file name, so I have S00E00 -. Keep in mind some folders, such as Christmas, have 30+ seasons.

{parent1} will provide the parent name.