mirror of
https://github.com/rclone/rclone.git
synced 2025-06-24 14:01:31 +02:00
drive: make DirMove more efficient and complain about moving the root
This commit is contained in:
parent
48a2e3844d
commit
d132dc7640
@ -771,12 +771,16 @@ func (f *Fs) DirMove(src fs.Fs) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if destination exists
|
// Check if destination exists
|
||||||
f.dirCache.ResetRoot()
|
if f.dirCache.FoundRoot() {
|
||||||
err := f.dirCache.FindRoot(false)
|
|
||||||
if err == nil {
|
|
||||||
return fs.ErrorDirExists
|
return fs.ErrorDirExists
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Refuse to move to or from the root
|
||||||
|
if f.root == "" || srcFs.root == "" {
|
||||||
|
fs.Debug(src, "DirMove error: Can't move root")
|
||||||
|
return errors.New("can't move root directory")
|
||||||
|
}
|
||||||
|
|
||||||
// Find ID of parent
|
// Find ID of parent
|
||||||
leaf, directoryID, err := f.dirCache.FindPath(f.root, true)
|
leaf, directoryID, err := f.dirCache.FindPath(f.root, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user