scp,文件结构保存不一致

scp, inconsistency for file structure preservation

谢谢!

Why is this happening [...]

在命令中scp -r path/to/source dest:

  • 如果dest不存在,将创建dest目录,并将path/to/source/*复制到其中。例如,如果您有 path/to/source/X,那么将创建 dest/X
  • 如果dest是一个目录,那么dest/source将被创建,path/to/source/*将被复制到其中。例如,如果您有 path/to/source/X,那么将创建 dest/source/X

[...] and how should I fix/get around it?

提前创建dest,例如:

mkdir -p /local/path/logs
scp -r $SERVERS:/remote/path/dir /local/path/logs