i have files in following format: Starts with 400 or Z400
- 40011111.mus
- 40011112.mus
- Z40011112.mus
I need to rename as following: Starts with Z100
- Z10011111.mus
- Z10011112.mus
- Z10011112.mus
Currently i have the following powershell function. but it adds Z as prefix. how do i undate the code so that it adds Z when necessary and changes 400 to 100?
function renameFiles{
echo " Start Rename Files"
get-childitem -path $mapfolder |
Where-Object {$_.extension -eq ".ditamap"} |
foreach-object {
echo " Renaming: $_ --> Z$_"
ren "$mapfolder\$_" "$mapfolder\Z$_"
}
}