WildCard serach for files in a directory

Hi i have a requirement to search for all files in a directory.

the files will start as file1_*,file2_*,file3_*

where the wild card character is a timestamp. so on a particular day i may get files like

file1_1103120042
file1_1102010345
file2_1101093423
file3_1103120042
file3_1102010345

my script should return a '1' only if all the three files i.e. file1_*,file2_* and file3_* are present in the directory. else it should return '0'.

Attention : in UNIX the true or OK condition is 0, everything else is false or ERROR.

function TestFiles ()
{
     for I in 1 2 3
     do
          ls file$I_* || return 1
     done
     return 0 # Not necessary
}

You can simply invoque that in a further test like

if TestFiles
then ...
else ...
fi

Hi,

the file1,file2 and file3 are examples that i gave.

All the three file names are completely different from each other. It would more be like.

testapp_110320092034
newfile_110320091634
obsolete_110420090334

in the same script how can i direct the return value to a text file in a directory?

function TestFiles ()
{   for I in testapp newfile obsolete
     do   ls file$I_* || return 1
     done
}

I don't know if you want to examine multiple directories.
You can use this simle statement in a terminal and look if it works

for I in testapp newfile obsolete; do ls file$I_* || echo "not found" > test.txt; done