summaryrefslogtreecommitdiff
path: root/eg/van/vanexp
blob: ef31882e22152d4f711ef20d5fe0aff53574ddc9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/perl

# $Header: vanexp,v 3.0 89/10/18 15:16:41 lwall Locked $

# This is for running from a find at night to expire old .deleteds

$can = $ARGV[0];

exit 1 unless $can =~ /.deleted$/;

($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size,$atime,$mtime,$ctime,
   $blksize,$blocks) = stat($can);

exit 0 unless $size;

if (time - $mtime > 2 * 24 * 60 * 60) {
    `/bin/rm -rf $can`;
}
else {
    `find $can -ctime +2 -exec rm -f {} \;`;
}