[ale] Scripting question

fletch at phydeaux.org fletch at phydeaux.org
Fri Apr 22 00:33:07 EDT 2005


> I have a directory with 148 ppm image files named like so:
> aea_h6_2-4ns_v2.0037.ppm
>
> I want to copy each file four times incrementing the name for each of
> the four copies.  So the file aea_h6_2-4ns_v2.0000.ppm is copied and
> renamed to the destination directory as:
> aea.0000.ppm
> aea.0001.ppm
> aea.0002.ppm
> aea.0003.ppm

#!/bin/zsh
c=0
for i in {0000..0148} ; do
  for j in {1..4} ; do
    cp aea.$i.ppm dst/aea.$( printf "%04d" $c ).ppm
    (( c = c + 1 ))
  done
done


-- 
Fletch                | "If you find my answers frightening,       __`'/|
fletch at phydeaux.org|  Vincent, you should cease askin'          \ o.O'
                      |  scary questions." -- Jules                =(___)=
                      |                                               U



More information about the Ale mailing list