Solved

A batch script to rename a list of images.

Posted on 2011-02-15
5
352 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 48

Expert Comment

by:dbrunton
ID: 34906311
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 54

Accepted Solution

by:
Bill Prew earned 500 total points
ID: 34920640
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
ID: 34945370
yes,billprew is a good coder.
0
 
LVL 54

Expert Comment

by:Bill Prew
ID: 34947714
Thanks so much, glad that helped.

~bp
0
 
LVL 2

Author Comment

by:marietto2008
ID: 34947727
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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Background Still having to process all these year-end "csv" files received from all these sources (including Government entities), sometimes we have the need to examine the contents due to data error, etc... As a "Unix" shop, our only readily …
Recently, an awarded photographer, Selina De Maeyer (http://www.selinademaeyer.com/), completed a photo shoot of a beautiful event (http://www.sintjacobantwerpen.be/verslag-en-fotoreportage-van-de-sacramentsprocessie-door-antwerpen#thumbnails) in An…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

740 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