#!/bin/sh ## Note this is untested ORIG_DIR=`pwd`; LOGFILE=/tmp/hh.debug.txt echo "ORIG_DIR=$ORIG_DIR" >> $LOGFILE; echo "ARGS = [" "$@" "]" >> $LOGFILE; for file in "$@"; do TARGET_DIR=`dirname "$file"`; cd "$TARGET_DIR"; case "$file" in *.aac) # Code to convert to .m4a e.g. $base.m4a STUB=`basename "$file" .aac` /Applications/mp4tools/mp4creator -create="$file" "$STUB".m4a ;; *.m4a) # Code to convert to .aac e.g. $base.aac STUB=`basename "$file" .m4a` /Applications/mp4tools/mp4creator -extract=1 "$file" "$STUB".aac ;; *) echo "Unknown file extension: $file"; ;; esac cd "$ORIG_DIR"; done