|1 2 4 8 16 32 64 128 256 512 1024|
-n Do not delete files; only print file names that would be deleted. -N Do not delete files; only print file names that would be retained. -p Do not process files. Print the specified schedule for count elements. -c count Keep count files. -s size Keep files totaling size bytes. The size argument can be followed by a k, m, g, or t uppercase or lowercase suffix to express quantities from kilobytes to terabytes. -a age Keep files up to the specified age. The age argument can be followed by a w, m, or y suffix to specify weeks, months, or years. -e base Use an exponential distribution of the specified base b for pruning. Each successive interval n will end at bn. As an example, a base of 2 will retain 10 files in a period of 1024 days. To determine the exponent for keeping n files in a period of d days use the formula exponent=e ln d / n -g sd Use a Gaussian (normal) distribution with the given standard deviation for the pruning schedule. The height of the curve with a standard deviation of s is given by the formula f(x)=1 / sqrt 2pisigmae-x2 / 2sigma2 All intervals from a to b are calculated to have the same
int ab f(x)dx The standard deviation is specified in day units; as a rule of a thumb the oldest file retained will have an age of twice the standard deviation.
-f Use a Fibonacci distribution for the pruning schedule. The Fibonacci sequence starts with 1, 1, and each subsequent term is the sum of the two previous ones. -t a||c For determining a files age use its access, modification, or creation time. By default the modification time is used. -F Force file pruning even if the size or count constraint has not been exceeded. -K Keep files scheduled in each pruning interval, even if the size or count constraint has been exceeded.
ssh remotehost tar cf - /datafiles >backup/date +%Y%m%d
fileprune -e 2 backup/*
Backup remotehost, storing the result in a file named with todays timestamp (e.g. 20021219). Prune the files in the backup directory so that each retained files age will be double that of its immediately younger neighbor.
fileprune -g 365 -c 30 *
Keep at most 30 files with their ages following a Gaussian (normal) distribution with a standard deviation of one year.
fileprune -e 2 -s 5G *
Prune the specified files following an exponential schedule so that no more than 5GB are occupied. More than one file may be left in an interval, if the size constraint is met. Alternatively, some old intervals may be emptied in order to satisfy the size constraint.
fileprune -F -e 2 -s 5G *
As above, but leave no more than one file in each scheduled interval.
fileprune -K -e 2 -s 5G *
As in the first example of the %g-constrained series, but leave exactly one file in each interval, even if this will violate the size constraint.
fileprune -a 1m -f
Delete all files older than one month use; use a Fibonacci distribution for pruning the remaining ones.
(C) Copyright 2002 Diomidis Spinellis.
The Gaussian (normal) distribution is calculated by trying successive increments of the normal functions distribution function. If the file number or count is large compared to the specified standard deviation, the calculation may take an exceedingly long time. To get results in a reasonable time, day increments are bounded at 10 times the increment of the previous interval and a total age of 100 years. It is advisable to first calculate and print the pruning schedule with a command like
fileprune -g 100 -p -c 20
to ensure that the schedule can be calculated.
|-->||FILEPRUNE (1)||13 October 2003|