"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
Make it so optional interface Purge can fail so it can be wrapped
Nick Craig-Wood2c2cb84ca7a6
diff --git a/fs/fs.go b/fs/fs.goindex 1d755ba62..a8c55775b 100644--- a/fs/fs.go+++ b/fs/fs.go@@ -25,6 +25,7 @@ var (fsRegistry []*Info// ErrorNotFoundInConfigFile is returned by NewFs if not found in config fileErrorNotFoundInConfigFile = fmt.Errorf("Didn't find section in config file")+ ErrorCantPurge = fmt.Errorf("Can't purge directory")ErrorCantCopy = fmt.Errorf("Can't copy object - incompatible remotes")ErrorCantMove = fmt.Errorf("Can't copy object - incompatible remotes")ErrorCantDirMove = fmt.Errorf("Can't copy directory - incompatible remotes")diff --git a/fs/operations.go b/fs/operations.goindex be62b1ea7..22fda131b 100644--- a/fs/operations.go+++ b/fs/operations.go@@ -734,14 +734,20 @@ func Rmdir(f Fs) error {//// FIXME doesn't delete local directoriesfunc Purge(f Fs) error {+ doFallbackPurge := truevar err errorif purger, ok := f.(Purger); ok {+ doFallbackPurge = falseif Config.DryRun {Debug(f, "Not purging as --dry-run set")} else {err = purger.Purge()+ if err == ErrorCantPurge {+ doFallbackPurge = true+ }}- } else {+ }+ if doFallbackPurge {// DeleteFiles and Rmdir observe --dry-runDeleteFiles(f.List())err = Rmdir(f)