1. You need a recurring instance with the highest possible frequency(polling for the event in high frequency will increase load for the server) which will wait for the event to occur.
2. The script should first delete the file and then create it in the same location with same name.