1

Say I want to rename files in a file tree and add an extension. I used this powershell command, but there is a bug: it adds the extension twice; why ? how to correct this ?

 get-childitem * -recurse -exclude *.h | where { !$_.PSIsContainer } |
     rename-item -newname {$_.name -replace '(\w*)','$1.h'} -whatif
Soleil
  • 5,506
  • 4
  • 35
  • 57

0 Answers0