Looping script several hundred times ?

Hi,

I need to get a script to run over 100 of different files in a folder.

The current input file is:
(However the input file has to change by one counter each loop of the script(e.g. 001, 002, 003...))

001.gif

At the end of the scrip the current output is:

001output.gif

It should also increase by 1 counter after each loop (to match the input files increase.

So after the script finished all gif files in the folder it should have produced as many XXXoutput.gifs as there were input gifs to begin with.
Since I can't state an exact number it should repeat this for all files in the folder.

Thanks in advance for any help.

the following works in cygwin -

$ for  i in $(seq 10) ; do  printf "%03d\n" $i; done
001
002
003
004
005
006
007
008
009
010

the problem is that I'm curently under Dos...

Thanks anyways.

Well if you can't put a decent shell on there, this works

@echo off
for /L %%A in ( 0 5 100 ) do (
	if %%A GTR 99 ( 
		echo %%A
	) else ( 
		if %%A GTR 9 (
			echo 0%%A
		) else (
		         echo 00%%A
		)
	)
)
@echo on

Well I guess what I wanted was kinda hard to understand...

Let me explain in a better way.

Lets say we have the following:

convert 001.gif -crop 128x128+0+0 001cropped.gif

The thing I want now, is:

I want DOS to process this command and then change the number of both the "001.gif" and "001cropped".gif by 1 counter and repeat the command.

This step should be processed till dos can't find a matching XXX.gif in the folder to input anymore.

so it is:
process script

  • increment numbers by 1 counter (002)
    process script again (with new counters)
  • increment numbers by 1 counter (003)
    ...

until the input file (lets say 558 for example) is no longer found and the script is terminated.

That would be exactly what I want.