date ranges

Hi,
Please anyone help to achive this using perl or unix scripting .

This is date in my table 20090224,based on the date need to check the files,If file exist for that date then increment by 1 for that date and check till max date 'i.e.20090301 and push those files .
files1_20090224
files2_20090225
files3_20090226
files4_20090227
files4_20090228
files4_20090301

script :I am not sure how to handle the date addition and check.

echo "----------------------------------------------------------------------" >/Temp/a.log

$ORACLE_HOME/bin/sqlplus -S 'Username/password@DB1'<<! | tee -a >/Temp/a.log

SELECT TO_CHAR(START_DT,'YYYYMMDD') FROM test WHERE FREQ='D';

!

date=`awk NF a.log |egrep -iv 'to_char|-----'`

echo $date
.............
...........

Thanks ,
Akil

Save your current date in currDate and then use Oracle to get the next date...

select to_char(to_date($currDate,'YYYYMMDD')+1,'YYYYMMDD') from dual;

Once you get the date store it in nextDate
and search for the file

ls file?_$nextDate

If you find the file take necessary action.

Hi
You mean to say that if check for 5 days ,need to query 5 times ,Is there any way to dynamic this?

Thanks,
Akil