WAY back when, when I got my first EZreader. It only used the file system, so I wanted folders. @CHALEY kindly supplied a template that divided things into 2 tree paths:
00noseries /Author-group/ Author
series /series-group /Series
I tweaked that later, any lousy code is mine

(attached # Calibre Send to Device template 11/2013)
Code:
program:test(field('series'),strcat(
substr(field('series'), 0, 1),template("-series/{series:subitems(0,1)||/}{series:subitems(1,2)||/}{series_index:0>5.2s}-{title}_{authors}")
),template("00noseries/{author_sort[0]}_authors/{authors}/{title}-{authors}")
)
Numbers are in front to get it to Alpha Sort
This might give you some ideas