mirror of
https://github.com/rclone/rclone.git
synced 2025-08-17 00:51:34 +02:00
sync: use operations.DirMove instead of sync.MoveDir for --fix-case - #7591
This should be more efficient for the purposes of --fix-case, as operations.DirMove accepts `srcRemote` and `dstRemote` arguments, while sync.MoveDir does not. This also factors the two-step-move logic to operations.DirMoveCaseInsensitive, so that it is reusable by other commands.
This commit is contained in:
@ -2288,6 +2288,17 @@ func DirMove(ctx context.Context, f fs.Fs, srcRemote, dstRemote string) (err err
|
||||
return nil
|
||||
}
|
||||
|
||||
// DirMoveCaseInsensitive does DirMove in two steps (to temp name, then real name)
|
||||
// which is necessary for some case-insensitive backends
|
||||
func DirMoveCaseInsensitive(ctx context.Context, f fs.Fs, srcRemote, dstRemote string) (err error) {
|
||||
tmpDstRemote := dstRemote + "-rclone-move-" + random.String(8)
|
||||
err = DirMove(ctx, f, srcRemote, tmpDstRemote)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return DirMove(ctx, f, tmpDstRemote, dstRemote)
|
||||
}
|
||||
|
||||
// FsInfo provides information about a remote
|
||||
type FsInfo struct {
|
||||
// Name of the remote (as passed into NewFs)
|
||||
|
Reference in New Issue
Block a user