mirror of
https://github.com/rclone/rclone
synced 2024-11-26 04:07:22 +01:00
local: make DirMove return fs.ErrorCantDirMove to allow fallback
Before this change `rclone move localdir /mnt/different-fs` would error. Now it falls back to moving individual files, which in turn falls back to copying individual files across the filesystem boundary.
This commit is contained in:
parent
25bbc5d22b
commit
724120d2f3
@ -535,7 +535,20 @@ func (f *Fs) DirMove(src fs.Fs, srcRemote, dstRemote string) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Do the move
|
// Do the move
|
||||||
return os.Rename(srcPath, dstPath)
|
err = os.Rename(srcPath, dstPath)
|
||||||
|
if os.IsNotExist(err) {
|
||||||
|
// race condition, source was deleted in the meantime
|
||||||
|
return err
|
||||||
|
} else if os.IsPermission(err) {
|
||||||
|
// not enough rights to write to dst
|
||||||
|
return err
|
||||||
|
} else if err != nil {
|
||||||
|
// not quite clear, but probably trying to move directory across file system
|
||||||
|
// boundaries. Copying might still work.
|
||||||
|
fs.Errorf(src, "Can't move dir: %v: trying copy", err)
|
||||||
|
return fs.ErrorCantDirMove
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hashes returns the supported hash sets.
|
// Hashes returns the supported hash sets.
|
||||||
|
Loading…
Reference in New Issue
Block a user