I have done something similar in Linux you can call commands or run files with a web server I haven't done this in a while but I made a file that runs commands which uses the terminal in Linux to run commands and after the commands where ran the out put folder is then renamed and finally copied to the appropriate web server folder.