Renaming a number of files; prepend

January 1, 2011 at 11:56:46
Specs: Windows Vista
I am trying to rename a series of files using the command prompt.
The original file names are STBL-EN000.jpg through to STBL-EN099.jpg
I want to rename them thus:
Big_STBL_EN000.jpg through to Big_STBL_EN099.JPG
I have made several attempts using wild cards but have only managed to get to:
Big_STBL_02.jpg through to Big_STBL_99.jpg
I seem to have lost the EN0 part of the file name

To do that I did it in a two stage process

Step 1
ren STBL-*.* ren STBL_*.*
That worked

Step 2

ren STBL*.* Big_STBL*.*
That changed (for example) STBL_EN038.jpg to Big_STBL38.jpg i.e it didn't work!

I know this sounds really geeky but it is driving me nuts as I know I managed to do this in DOS about 6 years ago.

I think it is related to wild cards and possibly the 8.3 limitations but as my original name was > 8 characters it might be a red herring.

Cna anyone help

See More: Renaming a number of files; prepend

Report •

January 1, 2011 at 17:44:42
@echo off & setLocal EnableDELAYedeXpansion

for /f "tokens=* delims= " %%a in ('dir/b STBL-EN*.jpg') do (
ren %%a Big_%%a

Life is too important to be taken seriously.


Report •
Related Solutions

Ask Question