Implement move command - fixes #35

* Define Mover interface to move a single object
  * Define DirMover interface to move a directory
  * Implement DirMove operation
  * Add `rclone move` command
  * Tests for Dir Move

To Do
  * Implement Move, DirMover in local, drive, dropbox
  * unit test for Mover
  * unit test for DirMover
This commit is contained in:
Nick Craig-Wood
2015-08-24 21:42:23 +01:00
parent d298b578ab
commit 59ba8f28c8
5 changed files with 188 additions and 19 deletions

View File

@@ -67,7 +67,7 @@ var Commands = []Command{
unchanged files, testing by size and modification time or
MD5SUM. Doesn't delete files from the destination.`,
Run: func(fdst, fsrc fs.Fs) error {
return fs.Sync(fdst, fsrc, false)
return fs.CopyDir(fdst, fsrc)
},
MinArgs: 2,
MaxArgs: 2,
@@ -83,7 +83,22 @@ var Commands = []Command{
source, including deleting files if necessary. Since this can
cause data loss, test first with the --dry-run flag.`,
Run: func(fdst, fsrc fs.Fs) error {
return fs.Sync(fdst, fsrc, true)
return fs.Sync(fdst, fsrc)
},
MinArgs: 2,
MaxArgs: 2,
Retry: true,
},
{
Name: "move",
ArgsHelp: "source:path dest:path",
Help: `
Moves the source to the destination. This is equivalent to a
copy followed by a purge, but may use server side operations
to speed it up. Since this can cause data loss, test first
with the --dry-run flag.`,
Run: func(fdst, fsrc fs.Fs) error {
return fs.MoveDir(fdst, fsrc)
},
MinArgs: 2,
MaxArgs: 2,