You can use the File::Find module. It even has a find2perl utility for
taking the work of writing a matching subroutine out:
Then you get something like
#!/usr/local/bin/perl -w
use strict;
use FindBin qw{$Bin};
use File::Find;
find(\&wanted, $Bin);
sub wanted {
(my ($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
(int(-M _) > 7) &&
/\.log$/ &&
(unlink($_) || warn "$name: $!\n");
}
On Monday, July 29, 2002, at 03:37 AM, NYIMI Jose (BMB) wrote:
> Hello,
>
> I would like to clean up my logfile directory by removing files that
> are older than 7 days.
> So I wrote something like:
>
> /user/local/bin/perl -w
> use strict;
> use FindBin qw($Bin);
> #
> `find $Bin
> #
> __END__
>
> My question is: how can I use perl's synthax instead of unix command
> "find" ?
> Thus avoid using backsticks.
>
> Thanks for your help.
>
> Jos�.
>
>
> **** DISCLAIMER ****
>
> "This e-mail and any attachment thereto may contain information which
> is confidential and/or protected by intellectual property rights and
> are intended for the sole use of the recipient(s) named above.
> Any use of the information contained herein (including, but not limited
> to, total or partial reproduction, communication or distribution in any
> form) by other persons than the designated recipient(s) is prohibited.
> If you have received this e-mail in error, please notify the sender
> either by telephone or by e-mail and delete the material from any
> computer".
>
> Thank you for your cooperation.
>
> For further information about Proximus mobile phone services please see
> our website at http://www.proximus.be or refer to any Proximus agent.
>
>
// George Schlossnagle
// Principal Consultant
// OmniTI, Inc http://www.omniti.com
// (c) 240.460.5234 (e) [EMAIL PROTECTED]
// 1024D/1100A5A0 1370 F70A 9365 96C9 2F5E 56C2 B2B9 262F 1100 A5A0
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]