How can I mass rename files?

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.

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.


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.


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.