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