This script with the help of a trigger will run every 5 minutes and will change the owner of the selected folder.
Step 1: Navigate to Google Drive and open the script editor (New -> Google Apps Script)
Step 2: Copy the script and paste it into editor
Step 3: Execute the script by clicking on the play button
Step 4: Accept all the permissions
Step 5: Set triger for auto execution (Resources -> All your triggers -> Add a new trigger)
Step 6: Set the trigger as time driver and set the time interval as 5 minutes
Feel free to use it and change it.