PowerShell

From Jesse's Wiki
Revision as of 22:10, 16 August 2022 by Jesse (talk | contribs) (Created page with "Batch rename files in a directory, subtract text from the end of each file (e.g. replace N with number of characters to remove<syntaxhighlight lang="powershell"> ls | Rename-I...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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}