0

I need a .bat file that can go into a folder with many sub-folders and rename every .iso file to "Game.iso". I had a way to do it but I cant seem to find it anymore and I lost the damn file :(.

Example:
-Main DIR
--A
---file name.iso
--B
---file name.iso
--Z
---file name.iso

What I want to be like when I run .bat file:
-Main DIR
--A
---game.iso
--B
---game.iso
--Z
---game.iso

That is really my main concern. That would be super amazing and I would appreciate it tremendously.

Juan71287
  • 3
  • 2
  • While I was looking and serching because I needed this done asap. I found a script to edit file extension from HTML to HTM, I edited it a bit because it seemed very easy to edit, and I got it working :) for /r %%x in (*.iso) do ren "%%x" game.iso – Juan71287 Aug 14 '14 at 10:57

1 Answers1

3

Simple:

for /r %%a in (*.iso) do (
ren "%%~a" "%%~paGame.iso"
)

And that should work. Simply run it from the Main Dir

Monacraft
  • 6,510
  • 2
  • 17
  • 29
  • +1, I would ditch the parens and make it a one liner :-) Of course your code only works properly if no folder has more than one .iso file within it. But that is an inherent issue with the question as stated. – dbenham Aug 11 '14 at 01:29
  • OK so it did not work :*(. I think what DBENHAm mentioned about not more than 1 file in each folder might have caused it not to work because I do have some folders with more than 1 file. Any ideas? – Juan71287 Aug 12 '14 at 00:23
  • Is there another way of doing this so it works with more than 1 file per folder? Much thanks! :) – Juan71287 Aug 13 '14 at 10:43
  • @juan71287 - you tell us. What do you want when you have multiple .iso files in one folder? You can't solve a problem if you don't define it properly. – dbenham Aug 15 '14 at 18:34