batch renaming

May 15, 2011 at 10:01:52
Specs: Windows XP
I like to rename a whole bunch of files.
The files are named: Doe, John - Nice book.epub
I like to rename them to: John Doe - Nice book.epub
How do i do that?

Thanks in Advance.


See More: batch renaming

Report •

#1
May 15, 2011 at 20:42:18
The amount of information you give leaves a lot to be desired. Are all the files named Doe, John - Nice book.epub? If so they must be in different directories!

Here's a short untested batch script which depends on the filename format being exactly as you state:

@echo off
cls
setlocal enabledelayedexpansion

for /f "tokens=*" %%1 in ('dir /b *.epub') do (
    set filename=%%1
        for /f "tokens=1-2* delims=, " %%A in ("!filename!") do (
            ren "!filename!"  "%%B %%A %%C"
    )
)    


Please come back & tell us if your problem is resolved.


Report •

#2
May 16, 2011 at 10:02:00
Hello,

Your script works fine.
I just renamed a whole bunch of files.

Thanks.


Report •

#3
May 16, 2011 at 13:59:15
Greenleg - thank you for coming back to report your success.


Please come back & tell us if your problem is resolved.


Report •
Related Solutions


Ask Question