Compare files from two directories

HI,

i want to compare one file from one directory to many files in other directory.
means in my /DIR/20070930/b/STG* directory i have only one file and
in /DIR/20070930/a/STG* directory i have many files. so i want to check the name of that files should be present in other directory or not

I have just written this script but i am failing to get the out put.

ls -1 /DIR/20070930/b/STG* > file1
ls -1 /DIR/20070930/a/STG* > file2
awk ' { FILENAME=="file1" { arr[$0]++}
{FILENAME=="file2" { if($0 in arr) {print $0}}' file1 file2

Any help will be appreciated
Thanks.

arr[$0]++, and if($0 in arr)
u maybe use this:
arr[$NF]++ and if($NR in arr)

The last one parameter of `ls -l ` is file name.

$0 has much info about every file in linux.

thanks for reply but i am getting error on executing this .. the error is
awk mismatch <<< filename>>>