mirror of
https://github.com/rclone/rclone.git
synced 2025-12-06 00:03:32 +00:00
copy, move: Copy single files directly, don't use --files-from work-around
Before this change rclone would inefficiently and confusingly read all the files in the source directory when copy or moving a single file. This caused confusion for the users to see log messages about files which weren't part of the sync. After the change the copy and move commands use the new infrastructure made for the copyto and moveto command for single file copy and move.
This commit is contained in:
@@ -2,6 +2,7 @@ package copy
|
||||
|
||||
import (
|
||||
"github.com/ncw/rclone/cmd"
|
||||
"github.com/ncw/rclone/fs/operations"
|
||||
"github.com/ncw/rclone/fs/sync"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
@@ -52,9 +53,12 @@ source or destination.
|
||||
`,
|
||||
Run: func(command *cobra.Command, args []string) {
|
||||
cmd.CheckArgs(2, 2, command, args)
|
||||
fsrc, fdst := cmd.NewFsSrcDst(args)
|
||||
fsrc, srcFileName, fdst := cmd.NewFsSrcFileDst(args)
|
||||
cmd.Run(true, true, command, func() error {
|
||||
return sync.CopyDir(fdst, fsrc)
|
||||
if srcFileName == "" {
|
||||
return sync.CopyDir(fdst, fsrc)
|
||||
}
|
||||
return operations.CopyFile(fdst, fsrc, srcFileName, srcFileName)
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user