Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
![]() |
![]() |
Home -> Community -> Mailing Lists -> Oracle-L -> Re: Deleting files from O/S older than 6 hours
Ajay Thotangare wrote:
> Is there any way I can delete files older than 6 hours. I am using
> HP-UNIX. I tried using
> /usr/bin/find /u01/log/*.log -mtime +0.4 -exec ls -l {} \;
> Above command does not work.
[...]
Solution provided by Stéphane CHAZELAS on c.u.s. for systems that don't have BSD/GNU-like utilities (see tinyurl.com/yo8yap for more details):
IFS='
'
timestamp=/tmp/__is_6_hours_old__$$
TZ=GMT touch -t `TZ=GMT+6 date +%Y%m%d%H%M.%S` $timestamp
ls -1drt `find . -mtime -1 -type f -print` $timestamp | sed -e "
\,$timestamp,q
s/[\"'\\\\[:blank:]]/\\\\&/g" | xargs rm -f
Regards
Dimitre
-- http://www.freelists.org/webpage/oracle-lReceived on Wed Nov 28 2007 - 06:23:40 CST
![]() |
![]() |