Vulcan::Cruft - Rotate log files and keep directories clean of cruft.
use Vulcan::Cruft; my $cruft = Vulcan::Cruft->new( @logdir, @logfile ); my %cut = $cruft->cut( size => '10MB', block => '8K' ); unlink $cruft->cruft ( count => 20, regex => qr/^foobar/, size => '100MB', age => '10days', );
Purge files according to %param. Returns a list of 'cruft'.
regex: pattern of file name. count: number of files to keep. size: total file size. age: age of file. remove: remove cruft.
Rotate files according to %param. Returns a hash of results.
size: max size of each segment. block: block size ( per cut ). count: number of files to keep.
Convert an $expr of $type to a number of base units. $type can be
time: base unit 1 second, units can be
s[econd] m[inutea h[our] d[ay] w[eek]
size: base unit 1 byte, units can be B K M G T P E Z Y
An expression may consist of multiple units, e.g.
'2h,3m,20s' or '2MB 10K'