try this.

Code:

$directory = "c:\temp"
$Dir = dirplus($Directory, "/s /a-d /f shtm")
For each $Element in $Dir
;Rename it to filename.shtm.tmp if it doesn't exist
$TmpFileName = $Element.path + ".tmp"
If not exist($TmpFileName)
$Element.Move($TmpFileName)
? "Renaming error: " + @error + @serror
endif
next