You can change the line
var thePath = theFolder2+"/"+theFile.name.replace(/\.\D{3}$/i, ".jpg");
to
var thePath = theFolder2+"/"+theFile.name.replace(/\.\D{3}$/i, "-Path.jpg");
but this is case sensitive, so "Path" really needs to have a capital initial letter.