Supress error message

Hi All

this is a simple script

#! /bin/bash

FileCnt=`ls -lrt $DIR/* | wc -l`
echo $FileCnt

how could i escape the error msg if there are no files in $DIR

ls: /home/sayantan/test/files/cnt/*: No such file or directory
0

Looking forward for a quick reply

Regards, Newbie

try sticking this at the end of the cmd:
> /dev/null 2>&1

so in your case it might be something like:

ls -lrt $DIR/* | wc -l > /dev/null 2>&1

FileCnt=`ls -lrt $DIR/* 2> /dev/null | wc -l`