b2sdk.sync.sync – Sync

b2sdk.sync.sync.count_files(local_folder, reporter)[source]

Counts all of the files in a local folder.

Parameters
b2sdk.sync.sync.make_file_sync_actions(sync_type, source_file, dest_file, source_folder, dest_folder, args, now_millis)[source]

Yields the sequence of actions needed to sync the two files

Parameters
b2sdk.sync.sync.make_folder_sync_actions(source_folder, dest_folder, args, now_millis, reporter, policies_manager=<b2sdk.sync.scan_policies.ScanPoliciesManager object>)[source]

Yields a sequence of actions that will sync the destination folder to the source folder.

Parameters
b2sdk.sync.sync.next_or_none(iterator)[source]

Returns the next item from the iterator, or None if there are no more.

b2sdk.sync.sync.sync_folders(source_folder, dest_folder, args, now_millis, stdout, no_progress, max_workers, policies_manager=<b2sdk.sync.scan_policies.ScanPoliciesManager object>, dry_run=False, allow_empty_source=False)[source]

Syncs two folders. Always ensures that every file in the source is also in the destination. Deletes any file versions in the destination older than history_days.

Parameters
  • source_folder (b2sdk.sync.folder.AbstractFolder) – source folder object

  • dest_folder (b2sdk.sync.folder.AbstractFolder) – destination folder object

  • args – an object which holds command line arguments

  • now_millis (int) – current time in milliseconds

  • stdout – standard output file object

  • no_progress (bool) – if True, do not show progress

  • max_workers (int) – max number of workers

  • policies_manager – policies manager object

  • dry_run (bool) –

  • allow_empty_source (bool) – if True, do not check whether source folder is empty

b2sdk.sync.sync.zip_folders(folder_a, folder_b, reporter, policies_manager=<b2sdk.sync.scan_policies.ScanPoliciesManager object>)[source]

An iterator over all of the files in the union of two folders, matching file names.

Each item is a pair (file_a, file_b) with the corresponding file in both folders. Either file (but not both) will be None if the file is in only one folder.

Parameters
Returns

yields two element tuples