#!/usr/bin/perl # # Usage: perl zeropadsnap.pl n imageseq # # files in imageseq are of the form snap.. # Each such file is replaced by one of the form # snap.. # # Dinoj Surendran 12 Feb 03 dinoj@cs.uchicago.edu ($n,@imagefiles) = @ARGV; for ($i = 0; $i < $#ARGV; $i++) { ($sn, $num, $ext) = split /\.+/ , $imagefiles[$i]; $num = sprintf( "%s", $num); $pad = ""; for (my $i=0; $i<$n-length($num); $i++) {$pad = $pad."0";} $nufile = $sn.".$pad".$num.".".$ext; $cmd = "mv ". $imagefiles[$i]." $nufile"; # print "$cmd\n"; system($cmd); }