How can I mass rename files?
Solution 1:
I know in your title you say "in dos" but I get the impression you are just looking for a way to do this and are wondering if that is the best way.
The absolute best tool I have found for this is Bulk Rename Utility.
It isn't a command line tool, but they do have a command line version if you really want to use it that way.
I've used the GUI version a lot, and it is very powerful, very fast and extremely easy to use.
Oh, and it is FREE for personal use.
Solution 2:
A small PowerShell script:
$args | Rename-Item -NewName { $_.Name.ToLower() -replace '\d+ - ' }
Combined with more complex regular expressions, this might become something like:
ls | Rename-Item -NewName {$_ -replace '(\d+) - (.*)\.mp3$', '$2 - $1.mp3' }
Which turns things like '01 - Beginning.mp3' into 'Beginning - 01.mp3'.
Use the -WhatIf
parameter on Rename-Item
to check renames before you issue them.
Solution 3:
If you really want to use the windows command line (if you don't want to download something), you could do it like this:
dir /B > fileList.txt
for /f "tokens=1,2,3" %i in (fileList.txt) DO ren "%i %j %l" %l
The first line outputs the list of files into a file called fileList.txt. The second line separates each of the names in the list into 3 parts, the #, the "-" and the rest of the name. For each of those it does the rename command.
Solution 4:
AntRenamer makes it quite easy to define a pattern of renaming; there are plenty of ones already prepared (and it gives a preview of the actions):
Free for personal and commercial use.