Shell script to check the file sitting in the directory more than 10 hours

Hi,

I require shell script to check for any pending files which are sitting in the particular directory for more than 10 hours.

Please help me on this...Thank you.

Hi,

What operating system are you using?

Have you tried anything yourself?

Gull04

Hi,

I am using AIX operating system & no I haven't tried anything.
I need it from the scratch.
Thanks in advance.

KK.

Hi, the below script will search through specified directories and look for specified files. If any file is older than 10 hours a notification email will be sent.

#!/bin/ksh

OUT=/tmp/outfile.txt

find /dir1 -cmin +600 -name "file1" > $OUT

find /dir2 -cmin +600 -name "file2" >> $OUT

find /dir3 -cmin +600 -name "file3" >> $OUT




if [[ -s $OUT ]] ; then

mail -s "Check why listed files have existed for more than 10 hours " emailaddre
ss.com < $OUT

fi

Regards
Andy

Hi..Thank you for the script.

But I no need of searching the directories,i have a directory in that list of file present & in that files sitting more than 10 hrs suppose to move destination directory.

I just want to get the output of the file more than 10 hrs - no mail required as well.

Thanks in advance.
KK

We are not seeing much effort from your side, we are not here to do the work for you but here to help you ...
So explain what you are not able to do and show us what you have done so far