Posted By

lottegis on 08/19/14


Tagged


Versions (?)

Mass-strip filenames from the first space


 / Published in: Windows PowerShell
 

Change file extension if required

  1. get-childItem | rename-item -newname { "$($_.BaseName -replace '_.+$','')$($_.Extension)" }
  2.  
  3. get-childItem | Where {$_\3.Extension -eq ".FILEXT"} | rename-item -newname { "$($_.BaseName -replace '_.+$','')$($_.Extension)" }
  4.  
  5. get-childItem -recurse | rename-item -newname { "$($_.BaseName -replace '_.+$','')$($_.Extension)" }

Report this snippet  

You need to login to post a comment.