Page 1 of 1

How batch rename files

Posted: 15 Aug 2012 03:34
by doscode
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
?

Re: How batch rename files

Posted: 15 Aug 2012 04:12
by foxidrive
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"

Re: How batch rename files

Posted: 15 Aug 2012 04:15
by doscode
Great, works well. Thanks

Re: How batch rename files

Posted: 15 Aug 2012 06:01
by Squashman
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

Re: How batch rename files

Posted: 16 Aug 2012 07:44
by jash08
Thanks so much... :) it works great!.
gw2 gold