scp是否允许在目​​标中重命名内联文件?

时间:2014-07-30 15:42:38

标签: scp

例如,我试过这个(通知来源是远程的):

scp root@$node:/sourcepath/sourcefile.log /destinationpath/destinationfile.log

另一个选项是之后重命名文件,但是在通过scp下载数据时动态执行它会更方便,其中我的问题。感谢。

1 个答案:

答案 0 :(得分:0)

Maybe without scp:

ssh yourserver "cat >tmpfile && mv tmpfile datafile" <datafile

This command copies the "datafile" file to a remote server under the name "tmpfile".

Only after successful copy renames the temporary file "tmpfile" to the right name "datafile" on remote host.

If copying was not successful, the remote host will be only a temporary file.

Thus, you are protected from getting no full "datafile" file.

Sorry for my English.