Here is a template Chaley did for me a long time ago
Code:
program:test(field('series'),strcat(
substr(field('series'), 0, 1),template("-series/{series:subitems(0,1)||/}{series:subitems(1,2)||/}{series_index:0>2s}-{title}-{authors}_{id}")
),strcat(template("00noseries/{author_sort[0]}_authors/{authors}/{title}-{authors}_{id}")
))
1 It creates a folder for the first letter of a series,_Series then makes a series folder...
OR, if no series
Creats a folder 00NoSeries (trick to sort before the series folders),
First letter of the Author lastname_Authors / authorname