Scripting to check the size of file and it's existance.

Hi,
I am totaly new to create a script . Please help.

I have file name retrived from SAP table into a internal table .
Like :-

/home/td_8d02_int_data_IPCL/ILLUSTRATIONS/CGM/l_pc_112138_01_0_01_00.cgm
/home/td_8d02_int_data_IPC-L/ILLUSTRATIONS/CMP/l_pc_112138_01_0_01_00.cmp

Objective :-
1) To check the above file size of file and it's existance on unix
2) For this we have to create a Script in SAP directory consisting of detail of above files , with unix code that will run on unix and check it's file size first and then it's existance.

Analysis :-
Loop at SAP_internal_table into variable lw_file

( lw_file 
/home/td_8d02_int_data_IPC-L/ILLUSTRATIONS/CGM/l_pc_112138_01_0_01_00.cgm

)

Now from here the creation of scripting starts***** ( Need your help in this )

#!/bin/ksh    
 
let nb_error = 0.
let nb_error_exist = 0.
 
Test -s  lw_file ( Please tell wether it is ok or not , we have to check the size of file greater than zero )
 
if [$? ! = "0"]
then
let nb_error = $ nb_error + 1

*************** Now here i want a internal table or array to store the file name only which is empty *************

Store the file name in a table1.

test -e lw_file ( Please tell wether it is ok or not , we have to check the existance of the file )

if [$? ! = "0"]
then
let nb_error_exist = $ nb_error_exist+ 1 

*************** Now here i want a internal table or array to store the file name only which does not exist *************

Store the file name in a table2.

FI
FI

******Writing of script data
List of missing released illustrations ( *Constant value )

Loop on table1.
Write the file name.

List of missing released illustrations ( *Constant value )

Loop on table2.
Write the file name.

This will be the desired result :-

List of missing released illustrations
l_pc_291334_01_0_01_00.cmp
l_pc_441133_50_0_02_00.cmp
l_pc_441133_55_0_02_00.cmp
 
List of empty released illustrations
l_pc_534941_01_0_01_00.cmp
 
End of record

No idea about SAP. but the UNIX part goes something like this..

file=/home/td_8d02_int_data_IPC-L/ILLUSTRATIONS/CGM/l_pc_112138_01_0_01_00.cgm
[ -f $file ] && echo "$file exists and size is $(ls -l $file | awk '{print $5}')" || echo "$file does not exist."