Applescript to run Mail rule on the Junk folder (or other folder)

Title says it all really.

iCloud mail is placing junk in the junk mailbox at the server side. When they arrive on my Mac they are already in the Junk folder and so my Rules are not applied to them automatically. (I have a number of repeat offending spammers which I would like to delete immediately).

So the question is can I make Mail app apply rules to the Junk folder, or to any other folder for that matter?

Much thanks for any help, as my searches have failed to turn up anything. :frowning: