Mass-strip filenames from the first space


/ Published in: Windows PowerShell
Save to your folder(s)

Change file extension if required


Copy this code and paste it in your HTML
  1. get-childItem | rename-item -newname { "$($_.BaseName -replace '_.+$','')$($_.Extension)" }
  2.  
  3. get-childItem | Where {$_.Extension -eq ".FILEXT"} | rename-item -newname { "$($_.BaseName -replace '_.+$','')$($_.Extension)" }
  4.  
  5. get-childItem -recurse | rename-item -newname { "$($_.BaseName -replace '_.+$','')$($_.Extension)" }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.