Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re (tilly) 2: Using Cron to Run Script

by tilly (Archbishop)
on Jan 05, 2002 at 19:06 UTC ( [id://136530]=note: print w/replies, xml ) Need Help??


in reply to Re: Using Cron to Run Script
in thread Using Cron to Run Script

The reason for the problem is that the filetests are going against the file names directly. So if you are listing files in directory /foo while you are in /bar, you are looking at whether /bar/baz is an old file when what you really wanted to know is whether /foo/baz is an old file.

You have posted one workaround. The other is:

my $logdir = "/whatdir/"; opendir(LOGDIR, $logdir) or die "Can't open '$logdir': $!\n"; foreach my $file ( grep {-f && (-M > 5)} map "$logdir$_", readdir(LOGDIR) ) { unlink $file; } closedir(LOGDIR);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://136530]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (5)
As of 2024-04-18 05:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found