

def sync_folder_to_container(self, folder_path, container, delete=False, include_hidden=False, ignore=None, ignore_timestamps=False, object_prefix='', verbose=False):
    '\n        Compares the contents of the specified folder, and checks to make sure\n        that the corresponding object is present in the specified container. If\n        there is no remote object matching the local file, it is created. If a\n        matching object exists, the etag is examined to determine if the object\n        in the container matches the local file; if they differ, the container\n        is updated with the local file if the local file is newer when\n        `ignore_timestamps\' is False (default). If `ignore_timestamps` is True,\n        the object is overwritten with the local file contents whenever the\n        etags differ. NOTE: the timestamp of a remote object is the time it was\n        uploaded, not the original modification time of the file stored in that\n        object.  Unless \'include_hidden\' is True, files beginning with an\n        initial period are ignored.\n\n        If the \'delete\' option is True, any objects in the container that do\n        not have corresponding files in the local folder are deleted.\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        If `object_prefix` is set it will be appended to the object name when\n        it is checked and uploaded to the container. For example, if you use\n        sync_folder_to_container("folderToSync/", myContainer,\n            object_prefix="imgFolder") it will upload the files to the\n        container/imgFolder/... instead of just container/...\n\n        Set `verbose` to True to make it print what is going on. It will\n        show which files are being uploaded and which ones are not and why.\n        '
    cont = self.get_container(container)
    self._local_files = []
    if verbose:
        log = logging.getLogger('pyrax')
        log.info('Loading remote object list (prefix=%s)', object_prefix)
    data = cont.get_objects(prefix=object_prefix, full_listing=True)
    self._remote_files = dict(((d.name, d) for d in data))
    self._sync_summary = {
        'total': 0,
        'uploaded': 0,
        'ignored': 0,
        'older': 0,
        'duplicate': 0,
        'failed': 0,
        'failure_reasons': [],
        'deleted': 0,
    }
    self._sync_folder_to_container(folder_path, cont, prefix='', delete=delete, include_hidden=include_hidden, ignore=ignore, ignore_timestamps=ignore_timestamps, object_prefix=object_prefix, verbose=verbose)
    self._remote_files = None
    if verbose:
        summary = self._sync_summary
        log.info(('Folder sync completed at %s' % time.ctime()))
        log.info(('  Total files processed: %s' % summary['total']))
        log.info(('  Number Uploaded: %s' % summary['uploaded']))
        log.info(('  Number Ignored: %s' % summary['ignored']))
        log.info(('  Number Skipped (older): %s' % summary['older']))
        log.info(('  Number Skipped (dupe): %s' % summary['duplicate']))
        log.info(('  Number Deleted: %s' % summary['deleted']))
        log.info(('  Number Failed: %s' % summary['failed']))
        if summary['failed']:
            for reason in summary['failure_reasons']:
                log.info(('  Reason: %s' % reason))

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