You can use javascript within Templater and get a chat robot to write the code for you. Never tried this kind of thing before so there might be dependencies for accessing the file system.
And of course, it’s easier to do some things outside of Obsidian. Get the robot to write a shell script (test the script in a small-scale environment first and otherwise make backups). Definitely need some automation for 10k+ files.