Well, there doesn't appear to be a loop to loop through a list of idnumbers, but the script is a good place to start. You could probably make a plugin of it to scan a dir for changes and update the user pictures. That way you could manage the upload so it doesn't overwork your server processing 36k images at once.
General developer forum
Update Moodle user's photo programmatically
This discussion has been locked so you can no longer reply to it.