

def upload_folder(self, folder_path, container=None, ignore=None, ttl=None):
    "\n        Convenience method for uploading an entire folder, including any\n        sub-folders, to Cloud Files.\n\n        All files will be uploaded to objects with the same name as the file.\n        In the case of nested folders, files will be named with the full path\n        relative to the base folder. E.g., if the folder you specify contains a\n        folder named 'docs', and 'docs' contains a file named 'install.html',\n        that file will be uploaded to an object named 'docs/install.html'.\n\n        If 'container' is specified, the folder's contents will be uploaded to\n        that container. If it is not specified, a new container with the same\n        name as the specified folder will be created, and the files uploaded to\n        this new container.\n\n        You can selectively ignore files by passing either a single pattern or\n        a list of patterns; these will be applied to the individual folder and\n        file names, and any names that match any of the 'ignore' patterns will\n        not be uploaded. The patterns should be standard *nix-style shell\n        patterns; e.g., '*pyc' will ignore all files ending in 'pyc', such as\n        'program.pyc' and 'abcpyc'.\n\n        The upload will happen asynchronously; in other words, the call to\n        upload_folder() will generate a UUID and return a 2-tuple of (UUID,\n        total_bytes) immediately. Uploading will happen in the background; your\n        app can call get_uploaded(uuid) to get the current status of the\n        upload. When the upload is complete, the value returned by\n        get_uploaded(uuid) will match the total_bytes for the upload.\n\n        If you start an upload and need to cancel it, call\n        cancel_folder_upload(uuid), passing the uuid returned by the initial\n        call.  It will then be up to you to either keep or delete the\n        partially-uploaded content.\n\n        If you specify a `ttl` parameter, the uploaded files will be deleted\n        after that number of seconds.\n        "
    if (not os.path.isdir(folder_path)):
        raise exc.FolderNotFound(("No such folder: '%s'" % folder_path))
    ignore = utils.coerce_to_list(ignore)
    total_bytes = utils.folder_size(folder_path, ignore)
    upload_key = str(uuid.uuid4())
    self.folder_upload_status[upload_key] = {
        'continue': True,
        'total_bytes': total_bytes,
        'uploaded': 0,
    }
    self._upload_folder_in_background(folder_path, container, ignore, upload_key, ttl)
    return (upload_key, total_bytes)

dataset/ETHPy150Open rackspace/pyrax/pyrax/object_storage.py StorageClient.upload_folder/original