How batch rename files

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
doscode
Posts: 175
Joined: 15 Feb 2012 14:02

How batch rename files

#1 Post by doscode » 15 Aug 2012 03:34

Hello,
how batch rename files in this format:
000_362 flames 4 small.bmp
000_363 flames 4 bigger.bmp
000_435 trees.bmp
013_435 trees.bmp
010_4728 palms&bushes.bmp

to:
362_000 flames 4 small.bmp
363_000 flames 4 bigger.bmp
435_000 trees.bmp
435_013 trees.bmp
4728_010 palms&bushes.bmp
?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: How batch rename files

#2 Post by foxidrive » 15 Aug 2012 04:12

Untested:

Code: Select all

@echo off
for /f "tokens=1,2,* delims=_ " %%a in ('dir *.bmp /b') do ren "%%a_%%b %%c" "%%b_%%a %%c"

doscode
Posts: 175
Joined: 15 Feb 2012 14:02

Re: How batch rename files

#3 Post by doscode » 15 Aug 2012 04:15

Great, works well. Thanks

Squashman
Expert
Posts: 4484
Joined: 23 Dec 2011 13:59

Re: How batch rename files

#4 Post by Squashman » 15 Aug 2012 06:01

doscode wrote:Hello,
how batch rename files in this format:
000_362 flames 4 small.bmp
000_363 flames 4 bigger.bmp
000_435 trees.bmp
013_435 trees.bmp
010_4728 palms&bushes.bmp

to:
362_000 flames 4 small.bmp
363_000 flames 4 bigger.bmp
435_000 trees.bmp
435_013 trees.bmp
4728_010 palms&bushes.bmp
?

Basically the same FOR loop concept you have used in all these previous threads. TOKENS and DELIMS.
http://www.dostips.com/forum/viewtopic.php?f=3&t=3457
http://www.dostips.com/forum/viewtopic.php?f=3&t=3435
http://www.dostips.com/forum/viewtopic.php?f=3&t=3422
http://www.dostips.com/forum/viewtopic.php?f=3&t=3421
http://www.dostips.com/forum/viewtopic.php?f=3&t=3383

jash08
Posts: 1
Joined: 16 Aug 2012 07:32

Re: How batch rename files

#5 Post by jash08 » 16 Aug 2012 07:44

Thanks so much... :) it works great!.
gw2 gold

Post Reply