Export scripting of multiple folders?

See
Maximum number of files loaded at once
on the memory problem.

The only workaround would be to split the library manually (e.g. first all artists 0 ... M, then N...Z). I cannot think of an automatism in the way you described it.