shopt -s nullglob
set -- "$WORK_DIR/$SRC_FILE_EXT"*
printf 'There are %d names that match "%s"\n' "$#" "$WORK_DIR/$SRC_FILE_EXT*"
That is, expand the pattern that matches the names that you are interested in, setting the positional parameters. The special variable $# will contain the number of matched names. Set the nullglob shell option in bash to let the pattern expand to nothing if it does not match at all.
If you want to make sure that you don't match directories, you may use a simple loop that counts the non-directories:
shopt -s nullglob
num=0
for name in "$WORK_DIR/$SRC_FILE_EXT"*; do
[ ! -d "$name" ] && num=$(( num + 1 ))
done
printf 'There are %d non-directories with names that match "%s"\n' "$num" "$WORK_DIR/$SRC_FILE_EXT*"
Using find:
find "$WORK_DIR" -maxdepth 1 ! -type d -name "$SRC_FILE_EXT*" -exec echo x \; | wc -l
(assuming your find knows about the non-standard -maxdepth predicate). This would return the number of non-directories in $WORK_DIR whose names start with $SRC_FILE_EXT.
num=$( find "$WORK_DIR" -maxdepth 1 ! -type d -name "$SRC_FILE_EXT*" -exec echo x \; | wc -l )
printf 'There are %d non-directories with names that match "%s" in "%s"\n' \
"$num" "$SRC_FILE_EXT*" "$WORK_DIR"
There is a subtle difference between using shell globs to match names and using find in that find is more strict with its file type matching. The find utility will not detect a symbolic link to a file or a directory as a file or directory, but as a symbolic link, while the shell will dereference the symbolic link and test the thing that it links to.
-fif you want to check for regular file exists. (2) The word "multiple" confuses me, as this is not part of your script. (3) Always quote paths/filenames!! Use"${WORK_DIR}${SRC_FILE_EXT}"and"$LOG_FILE". (4) For debugging, make sure thatWORK_DIRandSRC_FILE_EXTare correctly set when runningif. And that you have a/in between. (5) For more debugging, useset -xto print out what is actually executed.