"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
Allow overlapping remotes in move when DirMove is supported
Nick Craig-Wood2058652fa4e5
diff --git a/cmd/move/move.go b/cmd/move/move.goindex dd0c422a2..fee132dd8 100644--- a/cmd/move/move.go+++ b/cmd/move/move.go@@ -15,7 +15,8 @@ var commandDefintion = &cobra.Command{Short: `Move files from source to dest.`,Long: `Moves the contents of the source directory to the destination-directory. Rclone will error if the source and destination overlap.+directory. Rclone will error if the source and destination overlap and+the remote does not support a server side directory move operation.If no filters are in use and if possible this will server side move` + "`" + `source:path` + "`" + ` into ` + "`" + `dest:path` + "`" + `. After this ` + "`" + `source:path` + "`" + ` will nodiff --git a/fs/sync.go b/fs/sync.goindex 2d7ccfc91..896191e00 100644--- a/fs/sync.go+++ b/fs/sync.go@@ -455,12 +455,6 @@ func MoveDir(fdst, fsrc Fs) error {ErrorLog(fdst, "Nothing to do as source and destination are the same")return nil}- // The two remotes mustn't overlap- if Overlapping(fdst, fsrc) {- err := ErrorCantMoveOverlapping- ErrorLog(fdst, "%v", err)- return err- }// First attempt to use DirMover if exists, same Fs and no filters are activeif fdstDirMover, ok := fdst.(DirMover); ok && fsrc.Name() == fdst.Name() && Config.Filter.InActive() {@@ -483,6 +477,13 @@ func MoveDir(fdst, fsrc Fs) error {}}+ // The two remotes mustn't overlap if we didn't do server side move+ if Overlapping(fdst, fsrc) {+ err := ErrorCantMoveOverlapping+ ErrorLog(fdst, "%v", err)+ return err+ }+// Otherwise move the files one by onereturn moveDir(fdst, fsrc)}diff --git a/fs/sync_test.go b/fs/sync_test.goindex df2227176..fcf44bea6 100644--- a/fs/sync_test.go+++ b/fs/sync_test.go@@ -671,6 +671,11 @@ func TestServerSideMoveWithFilter(t *testing.T) {func TestServerSideMoveOverlap(t *testing.T) {r := NewRun(t)defer r.Finalise()++ if _, ok := r.fremote.(fs.DirMover); ok {+ t.Skip("Skipping test as remote supports DirMove")+ }+subRemoteName := r.fremoteName + "/rclone-move-test"fremoteMove, err := fs.NewFs(subRemoteName)require.NoError(t, err)