【问题标题】:How to run shell commands in lftp to do file transfers?如何在 lftp 中运行 shell 命令进行文件传输?
【发布时间】:2020-10-19 14:48:48
【问题描述】:

我需要从包含子目录的远程目录中复制一些文件。我正在使用 lftp 来执行此操作,但其中的 shell 命令不起作用。有解决方法吗?请看下面的代码。非常感谢任何帮助!

lftp -u $USER,$PASS sftp://$HOST <<EOF 2>&1

#find file file_name with absolutepath from REMOTE_DIR which lies in any of its subdirectories
filefound=`find "${REMOTE_DIR}"`-name "{$file_name}"`

#Get the absolutepath for subdirectory where the file resides
dir_loc=`dirname "${filefound}"`

lcd ${LOCAL_DIR}
cd ${dir_loc}
get ${file_name}
bye
EOF

我得到的错误是: 文件发现:未找到命令 dir_loc: 找不到命令

【问题讨论】:

    标签: shell sftp file-transfer lftp


    【解决方案1】:

    这是一个概念上的误解。

    您无法使用 SFTP 客户端运行 shell 命令。要运行 shell 命令,请使用 SSH 客户端。

    【讨论】:

      猜你喜欢
      • 2015-09-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-16
      • 2017-08-25
      • 2021-08-30
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多