protected function deleteDirectory($dir)
    {
        $files = new RecursiveIteratorIterator(
            new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS),
            RecursiveIteratorIterator::CHILD_FIRST
        );

        foreach ($files as $fileInfo) {
            $todo = ($fileInfo->isDir() ? 'rmdir' : 'unlink');

            $todo($fileInfo->getRealPath());
        }

        rmdir($dir);
    }
protected function deleteDirectory($dir)
    {
        $files = new RecursiveIteratorIterator(
            new RecursiveDirectoryIterator($dir, RecursiveDirectoryIterator::SKIP_DOTS),
            RecursiveIteratorIterator::CHILD_FIRST
        );

        foreach ($files as $fileInfo) {
            $todo = ($fileInfo->isDir() ? 'rmdir' : 'unlink');

            $todo($fileInfo->getRealPath());
        }

        rmdir($dir);
    }
protected function deleteDirectory ( $ dir ) { $ files = new RecursiveIteratorIterator ( new RecursiveDirectoryIterator ( $ dir , RecursiveDirectoryIterator :: SKIP_DOTS ) , RecursiveIteratorIterator :: CHILD_FIRST ) ; foreach ( $ files as $ fileInfo ) { $ todo = ( $ fileInfo -> isDir ( ) ? 'rmdir' : 'unlink' ) ; $ todo ( $ fileInfo -> getRealPath ( ) ) ; } rmdir ( $ dir ) ; }
Delete a whole directory.

@param $dir
Delete a whole directory .