Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: No. files in folder

by borisz (Canon)
on Jun 23, 2005 at 10:36 UTC ( #469351=note: print w/replies, xml ) Need Help??


in reply to No. files in folder

Your script also look for directories. Maybe you want to add a grep.
opendir my $d, $dir; # read dir, keep only files sort the files by modification time my @f = sort { -M $b <=> -M $a } grep { -f } readdir $d; # if we have more as 20 files remove the oldes two unlink @f[0,1] if @f > 20;
Boris

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2021-04-18 09:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?