Re: Deleting files from O/S older than 6 hours
- From: "Jared Still" <jkstill@xxxxxxxxx>
- To: "Ajay Thotangare" <ajayoraclel@xxxxxxxxx>
- Date: Wed, 28 Nov 2007 16:25:18 -0800
On Nov 28, 2007 2:37 PM, Ajay Thotangare <ajayoraclel@xxxxxxxxx> 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-l
- References:
- Re: Deleting files from O/S older than 6 hours
- From: Jared Still
- Re: Deleting files from O/S older than 6 hours
- From: Ajay Thotangare
Other related posts:
- » Deleting files from O/S older than 6 hours
- » Re: Deleting files from O/S older than 6 hours
- » Re: Deleting files from O/S older than 6 hours
- » Re: Deleting files from O/S older than 6 hours
- » Re: Deleting files from O/S older than 6 hours
- » Re: Deleting files from O/S older than 6 hours
- » RE: Deleting files from O/S older than 6 hours
- » Re: Deleting files from O/S older than 6 hours
- » Re: Deleting files from O/S older than 6 hours
- » Re: Deleting files from O/S older than 6 hours
- » Re: Deleting files from O/S older than 6 hours
- Re: Deleting files from O/S older than 6 hours
- From: Jared Still
- Re: Deleting files from O/S older than 6 hours
- From: Ajay Thotangare