Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> Re: Deleting files from O/S older than 6 hours

Re: Deleting files from O/S older than 6 hours

From: Radoulov, Dimitre <cichomitiko_at_gmail.com>
Date: Wed, 28 Nov 2007 13:23:40 +0100
Message-ID: <474D5DCC.8080805@gmail.com>


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-l
Received on Wed Nov 28 2007 - 06:23:40 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US