Finally got it to run without errors. I tried a different search in google and found this website
http://unix.stackexchange.com/questi...attern-in-bash
from which I found these two options for testing for the presence of one or more files of type whatever (JPG jpeg)
shopt -s nullglob
set -- *.txt
if [ "$#" -gt 0 ]; then
./script "$@" # call script with that list of files.
fi
$ ls
file1.pl file2.pl
# a failure
$ stat -t -- *.txt >/dev/null 2>&1
$ echo "$?"
1
# a success
$ stat -t -- *.pl >/dev/null 2>&1
$ echo "$?"
0
I used the first one and no more error messages from the rename command, also used it in the move to the other directory to stop the error I was getting if there were no files to move.