ExpireDir v1.10 01/06/2000 (c) torh@bogus.net (GPL)
What is it?
ExpireDir is a Perl program which will remove files from a directory if the directory usage has reached or breached a certain maximum. It will do so by removing the oldest files in the directory structure first.
ExpireDir can also remove files older than a certain number of days.
ExpireDir will not attempt to remove directories.
ExpireDir requires the CPAN module Getopt::Long.
- Usage
{torh@katchoo}% expiredir -h
expiredir v1.10 01/06/2000 (c) torh@bogus.net
usage: expiredir [-h|-v|-t] [-debug <debuglevel>] [-awk <awkpath>]
[-du <dupath>] [-days <days>] -w <bytes>[K|M|G] -d <startdir>
-v : print version string
-h : print this help
-t : only test, don't unlink (optional)
-d : set start directory
-w : watermark in bytes (or KB, MB, GB)
-days : also delete files that are <days> old -du : path to 'du' binary (optional) -awk : path to 'awk' binary (optional) -debug : set debug level (optional)
e.g. to remove the oldest files in "/var/spool/news" when the usage has breached 100MB, use the following command:
expiredir -w 100M -d /var/spool/news
or, to start removing files in /tmp when the usage has climbed above 102364 bytes, do:
expiredir -w 102364 -d /tmp
or, to make sure that files that are 7 days old also are deleted, do:
expiredir -w 102364 -days 7 -d /tmp
You can also set the "-t" flag, if you don't really want to delete any files, but just want to see which files it would have removed.
You may also set the level of debugging output. Maybe not very useful for you, but it's included nevertheless. If you wish a lot of output, set the debug level to 9 or higher (currently, 9 is the highest level).
