fileutils is the easiest way, in all recent SketchUp versions…
You have the basis of what’s needed, but you have not formatted the you posted in <…/> so
__FILE__ looks like FILE etc
When you newly named RB loads it needs to do a search for outdated RB and folder-name.
Let’s assume the RB file etc is referenced as
Assembled from the Plugins folder path and a name…
Similarly for the subfolder exists…
next if f=='.' || f=='..'
If there are nested subfolders inside the ‘OLD’ subfolder, then you need to empty those, and then delete them as you proceed, finally deleting the main ‘OLD’ subfolder…
this means trapping for file types - directory / folder - etc before clearing any contents…
But since you know your file/folder structure it should be relatively straightforward to set up a ‘list’ of things to process in a logical order…
Remember that the OLD file will have first loaded in the session when you first run your newly named files so a dialog prompting for a SketchUp restart after [if] your tidying has run up would also be in order…