PowerShell

From Jesse's Wiki
Jump to navigation Jump to search

Batch rename files in a directory, subtract text from the end of each file (e.g. replace N with number of characters to remove

ls | Rename-Item -NewName {$_.name.substring(0,$_.BaseName.length-N) + $_.Extension}