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
  • 6,404
  • 5
  • 41
  • 61

0 Answers0