roundcubemail/plugins/enigma/lib/enigma_engine.php
public static function delete_dir($dir)
    {
        // This code can be executed from command line, make sure
        // we have permissions to delete keys directory
        if (!is_writable($dir)) {
            rcube::raise_error("Unable to delete $dir", false, true);
            return false;
        }

        if ($content = scandir($dir)) {
            foreach ($content as $filename) {
                if ($filename != '.' && $filename != '..') {
                    $filename = $dir . DIRECTORY_SEPARATOR . $filename;

                    if (is_dir($filename)) {
                        self::delete_dir($filename);
                    }
                    else {
                        unlink($filename);
                    }
                }
            }

            rmdir($dir);
        }

        return true;
    }
public static function delete_dir($dir)
    {
        // This code can be executed from command line, make sure
        // we have permissions to delete keys directory
        if (!is_writable($dir)) {
            rcube::raise_error("Unable to delete $dir", false, true);
            return false;
        }

        if ($content = scandir($dir)) {
            foreach ($content as $filename) {
                if ($filename != '.' && $filename != '..') {
                    $filename = $dir . DIRECTORY_SEPARATOR . $filename;

                    if (is_dir($filename)) {
                        self::delete_dir($filename);
                    }
                    else {
                        unlink($filename);
                    }
                }
            }

            rmdir($dir);
        }

        return true;
    }
public static function delete_dir ( $ dir ) { // This code can be executed from command line, make sure // we have permissions to delete keys directory if ( ! is_writable ( $ dir ) ) { rcube :: raise_error ( "Unable to delete $dir" , false , true ) ; return false ; } if ( $ content = scandir ( $ dir ) ) { foreach ( $ content as $ filename ) { if ( $ filename != '.' && $ filename != '..' ) { $ filename = $ dir . DIRECTORY_SEPARATOR . $ filename ; if ( is_dir ( $ filename ) ) { self :: delete_dir ( $ filename ) ; } else { unlink ( $ filename ) ; } } } rmdir ( $ dir ) ; } return true ; }
Recursive method to remove directory with its content

@param string Directory
Recursive method to remove directory with its content