C# Select objects by sublayer

do you need a grasshopper approach or just a command / tool ?

there is
_selLayer
use it with commandline version
-_sellayer
and then use wildcard (Asterix)
-_sellayer "*Layer 01*"

this will select all layer pathes contain Layer 01
omit last Asterix to get childless Layers.