Add same numerical prefix to folder name and to its files

Hello, any help would be much appreciated.

I have a large number of podcasts consisting of one-off (radio) programmes and also of multiple series with two, three or more episodes. The folders have the names of the series and contain varying numbers of episodes.

In order to import them into my database program (CATraxx) I need to create two text files: one with the album (series) names and one with the track (episode) names. To link them together I need a common field in the album and track names. One problem is that the downloaded programme and episode names often have inconsistent name patterns. I would therefore like to have, for example, a button in DOpus which would add a unique number to the beginning of each folder name and also the same number to the beginning of the name of each file inside the folder. I know I could do this easily using flat view for individual folders but, given the large number of folders I have, it would be great to rename multiple folders and their contents at the same time.

(After checking the accuracy of the entries imported into my database, I would then be able to use flat view in DOpus to remove all of the numerical prefixes in one go.)

Many thanks for your help.