Skip to main content

Using split in powershell to get remove part of the filename



In order to change filenames in bulk using string you can use split switch to filter out first part of the file name.
For example, when I need to cut of "car" part of the file name, then I can use

get-childitem|%{$newname=$_.name -split ("car")|select -Last 1;Rename-Item $_.name -NewName $newname}