How do I remove the same part of a file name for many files in Windows 10, get-childitem | foreach { rename-item $_ $_.Name.Replace(“+”, “-“) }7?

Basically, I have an album of music and I want to remove the authors name from all of the mp3 files instead of having to manually do it myself. Is there a function in Windows 7 Ultimate that can do this for me?

You could also try using Powershell, a very powerful Windows command line tool. You’d run this command:

Full Command:

get-childitem *.mp3 | foreach { rename-item $_ $_.Name.Replace("Radiohead -", "") }

Analyzing it:

get-childitem .mp3
This just lists all files that have the words .mp3 in them. It is then passed to the next command with the | operator.

foreach { rename-item $_ $_.Name.Replace(“Radiohead -“, “”) }
This simply replaces all instances of Radiohead – with nothing, denoted by “” effectively wiping the word from all the files in the directory.

You could also modify get-childitem *.mp3 to get-childitem – It’d simply rename all the files in the directory, not just files that contain .mp3 (for future use)

 


my actual example

I want to remove “+” in my file names (like 0-0370+-+CRATER+LAKE)

Basically, I want to change from “+” to “-”

get-childitem
Here is the command line in Windows Powershell

get-childitem | foreach { rename-item $_ $_.Name.Replace("+", "-") }

first , you need to go type and search ” windows powershell

like this

windows powershell
windows powershell (windows 10)

cd directoryName  (go to your directory that file contains)

then execute this command

get-childitem | foreach { rename-item $_ $_.Name.Replace("+", "-") }

0-0370+-+CRATER+LAKE.jpg (before)  —->  0-0370—CRATER-LAKE.jpg (after)

windows powershell-get-childitem-foreach-rename-item
windows powershell-get-childitem-foreach-rename-item