Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

Re: checking file size

by Rhandom (Curate)
on Apr 19, 2001 at 09:11 UTC ( #73763=note: print w/replies, xml ) Need Help??

in reply to checking file size

You might try the following on for size:
#!/usr/bin/perl use File::Find qw(find); kill_big_files( "/tmp", 300*1024 ); sub kill_big_files { my $dir = shift; my $size = shift; find( sub { # current file is in $_ # current dir is the directory $_ is in return if -d; # skip directories return if -l; # skip links return if $size > -s; print "removing $_\n"; unlink; }, $dir); }
File::Find is a very useful tool. Very fast for making utilities which recurse directories.

Replies are listed 'Best First'.
Re: Re: checking file size
by merlyn (Sage) on Apr 19, 2001 at 17:16 UTC

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2020-08-04 03:05 GMT
Find Nodes?
    Voting Booth?
    Which rocket would you take to Mars?

    Results (31 votes). Check out past polls.