I use a bit more complicated one to do similar and avoid some pitfalls with the way you handle series:
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.2f}-{title}_{authors}_{id}")
),template("00noseries/{author_sort[0]}_authors/{author_sort}/{title}-{authors}_{id}")
)
I use 2 folder structures as my device only has File name sort
00Noseries for all non series books. The 00 rises to the top in a Alpha sort
Since I keep most of my Library on the device (SDCARD):
I create a Alphabetical layer of folders and distribute that way
00NoSeries:
A_Authors
B_Authors ...
(Series):
A_series
B_series
Series is also Hierarchical so there can ALSO be sub folders:
Pern/Dragonriders
Pern/Harperhall
(Pern)
With series... {Author} is LAST as you may have a series with more than 1 Author contributing, THE SERIES belongs together: series index-title Author, this way books are in alpha order
I also use ##.## for fine layer of series indexing