Put textures in seperate directories, sort by the shadersort you want to apply,then write something in php (or other) that reads the directories and files and addsshader according to the path and directory it's in.