code: static public function recursiveDelete($path)
      {
          if (is_file($path)) {
              return unlink($path);
          }
  
          $scans = glob(rtrim($path, '/') . '/*');
          foreach ($scans as $scan) {
              self::recursiveDelete($scan);
          }
  
          return rmdir($path);
      }
docs: Recursive delete direcotry
  
  @param string $path
  @return boolean