Need to delete unwanted files!!!

Hi all,
i am just a beginner in shell. Need some code for my problem.

SCENARIO

I have 2 directories. Let A,B.
Everyday files from directory A are compressed and moved to B.(already got the script).

In directory A

abc.doc
def.exe
ghi.c
jkl.pl

In directory B

abc.tar.gz
def.tar.gz
ghi.tar.gz

Now what i want is to delete all the files from A which were already compressed.(around 8k records/day)

So the remaining in the directory A should be

jkl.pl

I am not allowed to delete the files at least for 24 hours after compressed.
so i just need a fresh shell script which i will run the very next day after the compression.

Thanks:)

I think something like this should work:

ls A/. | while read line; do
   filename=`echo $line | cut -d '.' -f1`  # gets filename without ext
   if [ -f B/$filename.tar.gz ]; then     # cheks if file exists in B/<filename>.tar.gz
      rm -f A/$line                         # if so, removes file in A
   fi
done

Albert.