Script for Deleting files

Hi All,

I need a script which compares the sysdate and the file date(Last updated time stamp) and if the time difference is greater than 10 mins i need to delete that file. Can anyone help me pls??????

Ashok.

Working on HP-Unix.

How often will you run the script?
Manually or cron ?

Manually

And about once in an hour.

Quick answer if it doesn't matter that the script takes 10 mins to run. This construct will give you the names of the files to process. Customise and test thoroughly before deleting anything.

#!/bin/ksh
touch /tmp/mytimestamp
sleep 600 # 10 mins sleep at start of script
find /directory/ -type f ! -newer /tmp/timestamp -print | while read filename
do
ls -ald "${filename}"
done