Rename images to folder name batch file

This is the tree in the folders:

In this tree under the LV1 folder  there are images named: img01.jpg/img02.jpg/img03.jpg etc. upto img20.jpg

I want to rename the images to: 4B-MiniMatic-2-1mm-adj-AR21040_01.jpg uptil _20.jpg

I attached a listing of the folders within the main folder. Can a batch file be used to do this or is there a third party app I can use?
Ray PadillaIT DirectorAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

ste5anSenior DeveloperCommented:
Can a batch file be used to do this or is there a third party app I can use?

Yes and yes.
Ray PadillaIT  DirectorAuthor Commented:
thanks I need a batch file that will do this for me or a recommendation of an application that will do this.
NVITEnd-user supportCommented:
- Make a .bat file of this code.
- Code makes a .log in your TEMP folder
- Be sure to do on a test folder first!
@echo off
set fnlog=%temp%\%~n0.log
set ParentDir=C:\Users\Raymond\Desktop\Temp Files\WaterMark04292015

echo %date% %time% BEGIN %0 >>"%fnlog%"
pushd %ParentDir%
for /d %%a in (*) do (
  echo %%a
  pushd "%%a\images\%%a\lv1"
  echo %cd% >>"%fnlog%"
  for %%A in (*.jpg) do (
    set fnsfx=%%A
    set fn=%%a_!fnsfx:~3!
    echo ren "%%A" "!fn!" >>"%fnlog%"
    ren "%%A" "!fn!"
    set fnsfx=
    set fn=
echo %date% %time% END %0 >>"%fnlog%"

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Ray PadillaIT  DirectorAuthor Commented:
thanks worked!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft DOS

From novice to tech pro — start learning today.