Friday 29 March 2019

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=$ -split ("car")|select -Last 1;Rename-Item $ -NewName $newname}