This topic covers how we can remove a particular number of characters from a list of files in a folder(bulk removal) using powershell script.
get-childitem *.jpg | rename-item -newname { $_.basename.substring(0,$_.basename.length-1) + $_.extension }
Here it search for a list of all .jpg files in a folder. basename.length-1 means, it will clear last character of all files in a folder. So if you want to remove 5 characters from a list of files, then we need to modify the script as basename.length-5.
No comments:
Post a Comment