b2-sdk-python icon indicating copy to clipboard operation
b2-sdk-python copied to clipboard

How to deal with hidden files during sync

Open mlech-reef opened this issue 4 years ago • 3 comments

When the source is B2 and the file is hidden, the file on the destination won't be deleted even with KeepOrDeleteMode.DELETE.

We should talk if it's expected behavior or maybe the file should be deleted when the destination file is local. But when the destination file is B2 (bucket to bucket sync of the latest versions implemented in #165), then we may want to hide that file. It may require synchronizing not only the latest versions as described in #166

mlech-reef avatar Oct 28 '20 07:10 mlech-reef

I think it is a very old bug, which doesn't properly delete the local file if you sync a local folder to the cloud, remove a file from the cloud and sync back to the drive with --delete - you'd expect the local file to be deleted but it is kept due to a bug.

As for bucket-to-bucket sync, in such situation the user might want to hide the object on destination or delete the object on destination when the object is not present on the source. We just need an appropraite set of options for the user to decide what should be done. Could you suggest something?

ppolewicz avatar Oct 28 '20 11:10 ppolewicz

So if we consider it as a bug, then we can:

  • Fix it ;)
  • Add --hide argument for the sync which is mutually-exclusive with --delete and in SDK is reflected by a new KeepOrDeleteMode.HIDE value. The new parameter is allowed only when the destination is b2. Fully BC.

For better readability as the number of arguments in sync is growing, we can present them in different groups instead of the default optional arguments group.

mlech-reef avatar Oct 29 '20 15:10 mlech-reef

Argparse has Mutual exclusion support for arguments which may come in handy here.

I think we should add --hide and it should be promoted in examples of b2b sync.

@bwbeach - do we want to fix this? The most questionable issue is that so far the files missing (or hidden) from the source were kept after sync from cloud to local, even with --delete.

ppolewicz avatar Nov 08 '20 15:11 ppolewicz