How to rename certain movie filenames

Hi, I'm looking for some help to script the renaming of files such as:
"This.Is.The.Name.Of.a.Movie.2021.Blah.Blah.mkv" to "This Is The Name Of a Movie (2021).mkv"

Any help would be appreciated.




function OnGetNewName(getNewNameData) {
    var tmpStem = getNewNameData.newname_stem;
    var tmpExt = getNewNameData.newname_ext;

    tmpStem = tmpStem.replace(/\./g, ' ');
    tmpStem = tmpStem.replace(/(.*)(\d\d\d\d).*/, '$1($2)');

    return tmpStem + tmpExt;

39891.orp (604 Bytes)

Thank you very much for the quick reply and the solution works great :slight_smile: