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?
Solution 1:
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
.
Solution 2:
Forget about complicated scripts for this.
rename
is a very old and never properly completed command. If you do not use it properly, the result might surprise you.
For example to remove a prefix abcd
from abcd1.txt
, abcd2.txt
, abcd3.txt
etc. in order to get 1.txt
, 2.txt
, 3.txt
simply use
rename "abcd*.txt" "////*.txt"
You need the same number of /
as the number of initial characters you would like to remove.
Do place double quotes for both arguments.
Solution 3:
This might work.
Create a batch file as follows:
for %%i in ("*.mp3") do (set fname=%%i) & call :rename
goto :eof
:rename
::Cuts off 1st four chars, then appends prefix
ren "%fname%" "my%fname:~4%"
goto :eof
Source: http://www.codejacked.com/renaming-multiple-files-at-once-windows (in the comments, from "BlueNovember")
Solution 4:
ReNamer can do that. In ReNamer, just add a 'remove' rule like this (a 'delete' rule will also work):
And then drag and drop the files, or the folder containing the files you want renamed to its window (or use the 'Add Files/Folders' buttons), then check the preview, and once verified, click on 'Rename':