code: def rmdir(self, directory, missing_okay=False):
          
          # Build a script to walk an entire directory structure and delete every
          # file and subfolder.  This is tricky because MicroPython has no os.walk
          # or similar function to walk folders, so this code does it manually
          # with recursion and changing directories.  For each directory it lists
          # the files and deletes everything it can, i.e. all the files.  Then
          # it lists the files again and assumes they are directories (since they
          # couldn't be deleted in the first pass) and recursively clears those
          # subdirectories.  Finally when finished clearing all the children the
          # parent directory is deleted.
          command = """
              try:
                  import os
              except ImportError:
                  import uos as os
              def rmdir(directory):
                  os.chdir(directory)
                  for f in os.listdir():
                      try:
                          os.remove(f)
                      except OSError:
                          pass
                  for f in os.listdir():
                      rmdir(f)
                  os.chdir('..')
                  os.rmdir(directory)
              rmdir('{0}')
          """.format(
              directory
          )
          self._pyboard.enter_raw_repl()
          try:
              out = self._pyboard.exec_(textwrap.dedent(command))
          except PyboardError as ex:
              message = ex.args[2].decode("utf-8")
              # Check if this is an OSError #2, i.e. directory doesn't exist
              # and rethrow it as something more descriptive.
              if message.find("OSError: [Errno 2] ENOENT") != -1:
                  if not missing_okay:
                      raise RuntimeError("No such directory: {0}".format(directory))
              else:
                  raise ex
          self._pyboard.exit_raw_repl()
docs: Forcefully remove the specified directory and all its children.