Solved

A batch script to rename a list of images.

Posted on 2011-02-15
5
305 Views
Last Modified: 2012-05-11
Hello,

read here to be able to understand the previous episodes :

http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/Q_26789497.html

I'm trying to export a list of images from a video,from a starting frame number to an ending frame number. In the screenshot I wanted to start exporting images from br7429.jpg to br7478.jpg. I haven't understood how to do it with VirtualDub. Do you know a way to do it ? If this is not possible,I would like to use VirtualDUB to export images from br0.jpg to br (ending number).jpg and then a batch script to rename all the pictures from br0.jpg / br (ending number).jpg to br7429.jpg to br7478.jpg (in this specific situation).
15-02-2011-23-01-54.jpg
0
Comment
Question by:marietto2008
  • 2
  • 2
5 Comments
 
LVL 47

Expert Comment

by:dbrunton
Comment Utility
I've just taken a a look at VirtualDub.

You will have to take the second option.  If you change the Minimum number of digits you will get the numbering starting from 0 and going up to your ending number.

You will then need one of the scripting wizards to make you a batch file to do the converting to the number range you want.

However it might be better for the scripting wizards to leave the Minimum number of digits at 4 so you will end up with the first file as br0000.jpg but the name lengths will be consistent for easy manipulation.
0
 
LVL 51

Accepted Solution

by:
Bill Prew earned 500 total points
Comment Utility
Give this a try, I think it's what you are after.  Notice the REN has ECHO before it right now, for debugging.  It will just echo the REN command that would be executed.  See if this gives the results you need, and if so remove the ECHO.

@echo off
setlocal EnableDelayedExpansion
call :Offset 100 1000
exit /b

:Offset [ending-current-number] [offset-amount]
  for /L %%A in (%~1, -1, 0) do (
    set /A NewNum=%%A + %~2
    echo ren "br%%A.jpg" "br!NewNum!.jpg"
  )
  exit /b

Open in new window

~bp
0
 
LVL 2

Author Closing Comment

by:marietto2008
Comment Utility
yes,billprew is a good coder.
0
 
LVL 51

Expert Comment

by:Bill Prew
Comment Utility
Thanks so much, glad that helped.

~bp
0
 
LVL 2

Author Comment

by:marietto2008
Comment Utility
Really I haven't tried your code,but I know what it may works without problems. Here I was using an old tecnique to make an animation,now I'm trying to use more sophisticated tecniques.

0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now