case when (length(path1) - length(replace (path1, "\\", ""))) / length("\\") +1 >=1
then SUBSTRING_INDEX(SUBSTRING_INDEX(path1,'\\',1),'\\', -1 ) end as first_level_directory
Reference materials:
1. Example of Mysql splitting into multiple rows and columns according to a specific symbol
2. Mysql splitting a column into multiple records according to the delimiter Learning tutorial