Perl 68 bytes
utime$a+open(C,'>',$a=(stat$0)[8]),print(C"unlink~-$a"),$0;`perl $a`
Works in a similar fashion to the PHP script below, by updating its own access time to keep track of children names. As with all solutions below, the parent script may be named anything you choose.
PHP 87 bytes
It seems that since our parent is reproducing asexually, all it really needs to do is touch itself.
<?touch($f=__FILE__,1+$t=filemtime($f));fputs(fopen($t,w),"<?@unlink($t-1);");`php $t`;
PHP 110 (104) bytes
<?$f=$g=AAAAAAAA;fputs(fopen(++$f,w),"<?@unlink($g);fputs(fopen('".__FILE__."',c),'<?\$f=\$g=$f');");`php $f`;
If the parent is allowed to self-modify, a few bytes can be saved, mainly on quotation marks:
<?$f=$g=AAAAAAAA;fputs(fopen(++$f,w),"<?@unlink($g);");fputs(fopen(__FILE__,c),"<?\$f=\$g=$f");`php $f`;
Admittedly, the parent isn't very creative when naming its children. The first will be called AAAAAAAB
, the second AAAAAAAC
and so forth. The created child will delete its previous sibling, and modify its parent, making it somewhat 'older'.
The first child will contain the following (if the parent script is named parent.php
):
<?@unlink(AAAAAAAA);fputs(fopen('parent.php',c),'<?$f=$g=AAAAAAAB');