Yuki Tanabe provides some Google Apps Script code that can change the owner permissions of all folders and files in a particular folder in Google Drive
Source: Transfer owner rights under Google Drive folder at once with Google Apps Script-Qiita

Member of Google Developers Experts Program for Google Workspace (Google Apps Script) and interested in supporting Google Workspace Devs.