简体   繁体   English

fcopy使用tcl将文件从主机复制到vm

[英]fcopy to copy a file from host to vm using tcl

i want to use tcl command fcopy to copy a file from windows host machine to a vm location. 我想使用tcl命令fcopy将文件从Windows主机复制到vm位置。 What I get is I need a inchannel and a outchannel. 我得到的是我需要一个进货渠道和一个出货渠道。 Here inchannel in the filestream and out channel is some kind of socket where a server is runing maybe. 在这里,文件流的inchannel和out通道是某种正在运行服务器的套接字。 I am at bay regarding the server part and how the file will be saved from the socket in a vm path. 我在讨论服务器部分以及如何从套接字在vm路径中保存文件。 Please guide with some resource link. 请通过一些资源链接进行指导。

If you have two filenames (and both are currently visible, which depends on how things are mounted and which is totally out of baseline Tcl's control) use file copy . 如果您有两个文件名(当前都可见,这取决于安装方式以及完全不在Tcl的控制范围之内),请使用file copy Otherwise, if you can arrange to get the contents of the file somehow (perhaps by using ssh hostaddress cat ) then you use chan copy (which fcopy is the old name for). 否则,如果可以安排以某种方式获取文件的内容(也许使用ssh hostaddress cat ),则可以使用chan copyfcopy是其旧名称)。

set srcFD [open |[list ssh hostaddress cat "src/file.ext"] "r"]
set dstFD [open "dst/file.ext" "w"]

chan copy $srcFD $dstFD;    # Or: fcopy $srcFD $dstFD

close $srcFD
close $dstFD

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM