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
On Nov 28, 2007 2:37 PM, Ajay Thotangare <ajayoraclel_at_yahoo.com> wrote:
> HP does not support mmin.
> Thanks for good tip with respect to "-exec"
>
Surely you have Perl available? :)
The script at the end of this email will find all files in the current directory that are older than 6 hours.
It is a slightly modified version of what find2perl generates. (find2perl does not support -mmin, but the generated script can be hacked)
-- Jared Still Certifiable Oracle DBA and Part Time Perl Evangelist #! /usr/local/bin/perl -w use strict; use File::Find (); # Set the variable $File::Find::dont_use_nlink if you're using AFS, # since AFS cheats. # for the convenience of &wanted calls, including -eval statements: use vars qw/*name *dir *prune/; *name = *File::Find::name; *dir = *File::Find::dir; *prune = *File::Find::prune; sub wanted; my $currentTime=time; # Traverse desired filesystems File::Find::find({wanted => \&wanted}, 'find', '.'); exit; sub wanted { my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime); my $seconds=6*60*60; # 6 hours (($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime) = lstat($_)) && (($currentTime-$mtime) > $seconds) && print("$name\n"); } -- http://www.freelists.org/webpage/oracle-lReceived on Wed Nov 28 2007 - 18:25:18 CST
![]() |
![]() |