#!/bin/bash
# Purpose of this script is to take all of the files in a folder whose names
# follow a given pattern, sort them by name, and then to rename them
# 0001.jpg, 0002.jpg, etc., starting with $1  It's good, really, only for a 
# bunch of jpegs that I've captured using my methods for AGC program listings.

PAGE=$1
for n in `ls -1 *.jpg`
do
  mv $n `printf "%04d" $PAGE`-$n
  PAGE=$(($PAGE+1))
done


