mirror of
https://github.com/rclone/rclone.git
synced 2025-03-15 07:48:42 +01: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
|
||||
f.dirCache.ResetRoot()
|
||||
err := f.dirCache.FindRoot(false)
|
||||
if err == nil {
|
||||
if f.dirCache.FoundRoot() {
|
||||
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
|
||||
leaf, directoryID, err := f.dirCache.FindPath(f.root, true)
|
||||
if err != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user