Wednesday 20 November 2019

rename - How do I remove the same part of a file name for many files in Windows 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?


alt text



Answer



You could also try using PowerShell, a 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 lists all files whose names end with .mp3.  They are then piped to the next command with the | operator.


foreach { rename-item $_ $_.Name.Replace("Radiohead -", "") }
This 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 – that would rename all the files in the directory, not just files whose names end with .mp3.


No comments:

Post a Comment

How can I VLOOKUP in multiple Excel documents?

I am trying to VLOOKUP reference data with around 400 seperate Excel files. Is it possible to do this in a quick way rather than doing it m...