in reply to Age of dir in UNIX

Greetings.

While I'm not offering a complete solution. I think you might find this approach perhaps easier to follow.

#!/usr/bin/perl -w use strict; my $arg1 = ('-XP . -type l -cmin'); my $arg2 = ('+15'); my $arg3 = ('xargs rm'); system("/usr/bin/find $arg1 $arg2 | $arg3");
In this case, we're talking 15 minutes. And I clobber the file (xargs rm).
You would probably want to replace -type l with -type d. Then modify $arg3 to perform the task you are looking to accomplish.

Point being, you might find the command find a more reliable solution than stat.

Modify for your own needs. :)

HTH

--Chris

#!/usr/bin/perl -Tw
use Perl::Always or die;
my $perl_version = (5.12.5);
print $perl_version;

Replies are listed 'Best First'.
Re^2: Age of dir in UNIX
by kaka_2 (Sexton) on Dec 05, 2013 at 11:06 UTC

    Thank You for reply. Unfortunately it is on HPUX and there is no -cmin or -mmin

Re^2: Age of dir in UNIX
by oiskuu (Hermit) on Dec 05, 2013 at 17:04 UTC
    This is what shell aliases are for. More importantly, when going for a generic solution with find | xargs, one would be advised to make use of -print0 and -0 options:
      find ... -print0 | xargs -0 ...
    
    This serves to avoid "./nasty/surprises with spaces in file names /etc/fstab"