creating a file with time stamp

Hi guys,

Here my scenario is to find the files of previous days if the previous day load had not done. for that i created a file with time stamp and this file is created after the load completes. so every dau i search for the this file with previous days time stamp.

i want to create a file with time stamp..

file is empty. file name should be in yyyymmdd.txt format

how can i do this.

and one more thing is i have to used this filename in if condition for validation.

i.e if [ filename = previousdays date ]; then

-------------
else
-----------
fi

thanks in advance...

:confused::confused::confused: :wall:

previous_day=`TZ=GMT+24 date "+%Y%m%d"`

# change the directory to search the file

cd /search dir/

if [ -f "$previous_day".txt ] ##if file exists 
then
echo "filexists; do whatever you want to do"
else
echo "file not found"
#create the file
touch "$previous_day".txt
fi