#!/bin/bash

while [ ! -z "$1" ]; do

if [ ! -d "$1" ]; then
    echo "$1 is not a directory."
    shift
    break
fi

export i=0
ls -1tr "$1" | while read f; do
  i=$(( $i + 1 ))
  str=`printf '%02i\n' $i`
  ln "$f" cdr$str.wav
done

shift
done
