?
Solved

A batch script to rename a list of images.

Posted on 2011-02-15
5
Medium Priority
?
367 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 49

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 56

Accepted Solution

by:
Bill Prew earned 2000 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 56

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

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

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

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.
Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
Learn the basics of strings in Python: declaration, operations, indices, and slicing. Strings are declared with quotations; for example: s = "string": Strings are immutable.: Strings may be concatenated or multiplied using the addition and multiplic…
Learn the basics of modules and packages in Python. Every Python file is a module, ending in the suffix: .py: Modules are a collection of functions and variables.: Packages are a collection of modules.: Module functions and variables are accessed us…
Suggested Courses

762 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