Implement --no-traverse flag to stop copy traversing the destination remote.

Refactor sync/copy/move
  * Don't load the src listing unless doing a sync and --delete-before
  * Don't load the dst listing if doing copy/move and --no-traverse is set

`rclone --no-traverse copy src dst` now won't load either of the
listings into memory so will use the minimum amount of memory.

This change will reduce the amount of memory rclone uses dramatically
too as in normal operations (copy without --notraverse or sync) as it
no longer loads the source file listing into memory at all.

Fixes #8
Fixes #544
Fixes #546
This commit is contained in:
Nick Craig-Wood
2016-06-25 14:28:26 +01:00
parent 13797a1fb8
commit af4ef8ad8d
5 changed files with 174 additions and 109 deletions

View File

@@ -88,6 +88,7 @@ var (
dedupeMode = pflag.StringP("dedupe-mode", "", "interactive", "Dedupe mode interactive|skip|first|newest|oldest|rename.")
maxDepth = pflag.IntP("max-depth", "", -1, "If set limits the recursion depth to this.")
ignoreSize = pflag.BoolP("ignore-size", "", false, "Ignore size when skipping use mod-time or checksum.")
noTraverse = pflag.BoolP("no-traverse", "", false, "Don't traverse destination file system on copy.")
bwLimit SizeSuffix
// Key to use for password en/decryption.
@@ -223,6 +224,7 @@ type ConfigInfo struct {
DedupeMode DeduplicateMode
MaxDepth int
IgnoreSize bool
NoTraverse bool
}
// Transport returns an http.RoundTripper with the correct timeouts
@@ -327,6 +329,7 @@ func LoadConfig() {
Config.NoGzip = *noGzip
Config.MaxDepth = *maxDepth
Config.IgnoreSize = *ignoreSize
Config.NoTraverse = *noTraverse
ConfigPath = *configFile