public static function rmdir($path)
    {
        $files = array_diff(scandir($path), array('.', '..'));

        $filesystem = new Filesystem();

        foreach ($files as $file) {
            $file = $path . DIRECTORY_SEPARATOR . $file;

            if (!file_exists($file)) {
                continue;
            }

            try {
                $filesystem->remove($file);
            } catch (IOException $exception) {
                return false;
            }
        }

        return true;
    }
public static function rmdir($path)
    {
        $files = array_diff(scandir($path), array('.', '..'));

        $filesystem = new Filesystem();

        foreach ($files as $file) {
            $file = $path . DIRECTORY_SEPARATOR . $file;

            if (!file_exists($file)) {
                continue;
            }

            try {
                $filesystem->remove($file);
            } catch (IOException $exception) {
                return false;
            }
        }

        return true;
    }
public static function rmdir ( $ path ) { $ files = array_diff ( scandir ( $ path ) , array ( '.' , '..' ) ) ; $ filesystem = new Filesystem ( ) ; foreach ( $ files as $ file ) { $ file = $ path . DIRECTORY_SEPARATOR . $ file ; if ( ! file_exists ( $ file ) ) { continue ; } try { $ filesystem -> remove ( $ file ) ; } catch ( IOException $ exception ) { return false ; } } return true ; }
Recursiely remove all files from the given directory NOT including the
specified directory itself

@param string $path Directory to be cleaned out

@return bool
Recursiely remove all files from the given directory NOT including the specified directory itself