#!/bin/sh # get total number of files N=`ls -1 *.CR[23] 2>/dev/null | wc -l` if [ $N != 0 ]; then # mkdir if [ ! -d raw ]; then mkdir raw echo "Creating directory." fi # move files echo "Moving $N files." mv *.CR[23] raw/ else echo "No files found." fi