#!/bin/sh 
##
##  convert Fuji X-trans RAW to 16-bit TIFF
##
##  Author Nick Payne
##
## need folder or file argument
## if folder, process all RAF files in folder,
## otherwise, assume argument is RAF file and output single TIFF
if [ -z "$1" ]
then
	echo "File or folder name missing from command line";
	echo "Usage: fujiraw.sh <input dir> | <input file>";
	exit 1;
fi
if [ -d "$1" ]
then
	cd "$1"
	find . -maxdepth 1 -iname '*RAF' -exec dcraw -o 2 -w -v -6 -T {} \;
elif [ -f "$1" ]
then
	dcraw -o 2 -w -v -6 -T "$1";
else
	echo "$1 does not exist";
	exit 1;
fi

