Hi All,

I want to write a shell script that will find all the files modified
within 24 hours and copy those files into a new directory.
I have written the script but it is not working, it return me with all
the files instead of only those that modified within 24 hours.
Below is my script, appreciated if some one can help........

#!/bin/sh

DATE=`date +%y%m%d`

################################################## ###############################
# Part 1 : Move IDM log files to log archive directory
#
################################################## ###############################

cd /var/opt/novell/log/
mkdir /data/daily_log_archive/IDM_log_$DATE

for i in `ls`
do
if find ./$i -mtime -1 -type f
then
cp $i /data/daily_log_archive/IDM_log_$DATE
fi
done

tar cvzfp /data/daily_log_archive/IDM_log_$DATE.tar.gz
/data/daily_log_archive/IDM_log_$DATE
rm -rf /data/daily_log_archive/IDM_log_$DATE

################################################## ###############################


--
kaylayap
------------------------------------------------------------------------
kaylayap's Profile: http://forums.novell.com/member.php?userid=94293
View this thread: http://forums.novell.com/showthread.php?t=448641