I ran into this issue today and wondered whether such a script exists or if anyone could help me out.
I am trying to do this: Let's say I have a top-level layer that contains a bunch of nested layers, each with its specific name. What I am trying to do now is select these individual nested layers, and upon running a script, unnest and create top-level layers for each one, while also giving these new top layers the original layer's name.
I have found this built-in method of doing something similar. However, this still doesn't solve the top-level layer renaming issue, as it creates top-level layers named "Layer 1", "Layer 2", etc. My concern is mainly focused on not having to rename dozens of layers again.
Looking forward to hearing your scripting wisdom. Thank you very much!