mirror of
https://github.com/rclone/rclone.git
synced 2025-02-17 02:50:59 +01:00
moveto,copyto: clarify error message if source doesn't exist - fixes #1022
This commit is contained in:
parent
4c0e2f9b3b
commit
2a01fa9fa0
13
cmd/cmd.go
13
cmd/cmd.go
@ -198,6 +198,8 @@ func NewFsSrcDstFiles(args []string) (fsrc fs.Fs, srcFileName string, fdst fs.Fs
|
|||||||
fsrc, srcFileName = newFsSrc(args[0])
|
fsrc, srcFileName = newFsSrc(args[0])
|
||||||
// If copying a file...
|
// If copying a file...
|
||||||
dstRemote := args[1]
|
dstRemote := args[1]
|
||||||
|
// If file exists then srcFileName != "", however if the file
|
||||||
|
// doesn't exist then we assume it is a directory...
|
||||||
if srcFileName != "" {
|
if srcFileName != "" {
|
||||||
dstRemote, dstFileName = fs.RemoteSplit(dstRemote)
|
dstRemote, dstFileName = fs.RemoteSplit(dstRemote)
|
||||||
if dstRemote == "" {
|
if dstRemote == "" {
|
||||||
@ -207,7 +209,16 @@ func NewFsSrcDstFiles(args []string) (fsrc fs.Fs, srcFileName string, fdst fs.Fs
|
|||||||
log.Fatalf("%q is a directory", args[1])
|
log.Fatalf("%q is a directory", args[1])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fdst = newFsDst(dstRemote)
|
fdst, err := fs.NewFs(dstRemote)
|
||||||
|
switch err {
|
||||||
|
case fs.ErrorIsFile:
|
||||||
|
fs.Stats.Error(err)
|
||||||
|
log.Fatalf("Source doesn't exist or is a directory and destination is a file")
|
||||||
|
case nil:
|
||||||
|
default:
|
||||||
|
fs.Stats.Error(err)
|
||||||
|
log.Fatalf("Failed to create file system for destination %q: %v", dstRemote, err)
|
||||||
|
}
|
||||||
fs.CalculateModifyWindow(fdst, fsrc)
|
fs.CalculateModifyWindow(fdst, fsrc)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user