def upload_docs(self, paths, title=None, folder_entry=None,
                    file_ext=None, **kwargs):
        """Upload a list of documents or directories.

        For each item in paths:
          if item is a directory, upload all files found in the directory
            in a manner roughly equivalent to "cp -R directory/ <docs_folder>"
          if item is a file, upload that file to <docs_folder>

        Keyword arguments:
          paths: List of file paths and/or directories to upload.
          title: Title to give the files once uploaded.
                 Default None for the names of the files.
          folder_entry: GDataEntry of the folder to treat as the new root for
                        directories/files.
                        Default None for no folder (the Google Docs root).
          file_ext: Replace (or specify) the extension on the file when figuring
                  out the upload format. For example, 'txt' will upload the
                  file as if it was plain text. Default None for the file's
                  extension (which defaults to 'txt' if there is none).
          kwargs: Typically contains 'convert', indicates if we should convert the
                  file on upload. False will only be honored if the user is a Google
                  Apps Premier account.

        Returns:
          Dictionary mapping filenames to where they can be accessed online.
        """
        doc_entries = {}
        for path in paths:
            folder_root = folder_entry
            if os.path.isdir(path):
                folder_entries = {}
                # final '/' sets folder_name to '' which causes
                # 503 "Service Unavailable".
                path = path.rstrip(os.path.sep)
                for dirpath, dirnames, filenames in os.walk(path):
                    directory = os.path.dirname(dirpath)
                    folder_name = os.path.basename(dirpath)
                    if directory in folder_entries:
                        fentry = self._create_folder(
                            folder_name, folder_entries[directory])
                    else:
                        fentry = self._create_folder(folder_name, folder_root)
                    folder_entries[dirpath] = fentry
                    LOG.debug('Created folder ' + dirpath + ' ' + folder_name)
                    for fname in filenames:
                        doc = self.upload_single_doc(os.path.join(dirpath, fname),
                                                     folder_entry=fentry)
                        if doc:
                            doc_entries[fname] = doc
            else:
                doc = self.upload_single_doc(path, title=title,
                                             folder_entry=folder_entry,
                                             file_ext=file_ext,
                                             **kwargs)
                if doc:
                    doc_entries[os.path.basename(path)] = doc
        return doc_entries
dataset/ETHPy150Open vinitkumar/googlecl/src/googlecl/docs/base.py/DocsBaseCL.upload_docs/original