I did it this way so that the garbage collector would destroy the iterator immediately after the loop.

I could do something like this instead...
```php
$allfiles = new RecursiveIteratorIterator ( new RecursiveDirectoryIterator( $source, $flags ), RecursiveIteratorIterator::CHILD_FIRST )
foreach( $allfiles as $src ) {
    // [...]
}
unset( $allfiles );
rmdir( $source );
```
But I figured you would frown on the use of ```unset()```, which would have been required to use ```rmdir()```, otherwise PHP will keep the temp folder in use.