Find the illegal characters and use
Replace to strip them out in PowerShell. Below is an example how to replace
> characters with
NULL values which basically removes those characters.
It also appears that the
>> are not be valid characters for a folder name in a UNC path. So you might replace those with the valid location or give an example to further test what that is actually set to in your example.
$source = "\\md\drive\MMM\<<DriveEnv>>\AA\Extracts\Active\filename.csv"
$source = $source.Replace("<","")
$source = $source.Replace(">","")
$newfilename = $source
$newfilename = $newfilename + ".TEMP"
Rename-Item $source -NewName $newfilename