error-handling - 使用 psftp 无法忽略错误
问题描述
我希望将C:\Users\myuser\Downloads\SFTP
本地 Windows 文件夹中的所有文件上传到远程 SFTP 服务器的myfolder
目录。
以下是我的命令:
C:\putty\psftp.exe -b C:\putty\sftp_commands.txt -l myuser -pw mypass 10.8.44.86
这是我的C:\putty\sftp_commands.txt
文件:
mkdir myfolder
cd myfolder
lcd "C:\Users\myuser\Downloads\SFTP"
mput "C:\Users\myuser\Downloads\SFTP\*.*"
运行该命令会出现以下权限被拒绝错误:
C:\Users\myuser\Desktop>C:\putty\psftp.exe -b C:\putty\sftp_commands.txt -l myuser -pw mypass 10.8.44.86
Using username "myuser".
Pre-authentication banner message from server:
| EFT Server Enterprise 7.3.2.8
End of banner message from server
Keyboard-interactive authentication prompts from server:
End of keyboard-interactive prompts from server
Remote working directory is /
mkdir /myfolder: permission denied
然后我决定通过使用-be
psftp 的参数来忽略错误。这不起作用,我在输出中看到以下错误。
C:\Users\myuser\Desktop>C:\putty\psftp.exe -be C:\putty\sftp_commands.txt -l myuser -pw mypass 10.8.44.86
PuTTY Secure File Transfer (SFTP) client
Release 0.73
Usage: psftp [options] [user@]host
Options:
-V print version information and exit
-pgpfp print PGP key fingerprints and exit
-b file use specified batchfile
-bc output batchfile commands
-be don't stop batchfile processing if errors
-v show verbose messages
-load sessname Load settings from saved session
-l user connect with specified username
-P port connect to specified port
-pw passw login with specified password
-1 -2 force use of particular SSH protocol version
-4 -6 force use of IPv4 or IPv6
-C enable compression
-i key private key file for user authentication
-noagent disable use of Pageant
-agent enable use of Pageant
-hostkey aa:bb:cc:...
manually specify a host key (may be repeated)
-batch disable all interactive prompts
-no-sanitise-stderr don't strip control chars from standard error
-proxycmd command
use 'command' as local proxy
-sshlog file
-sshrawlog file
log protocol details to a file
C:\Users\myuser\Desktop>
你能建议我的代码有什么问题吗?
解决方案
推荐阅读
- r - 从列变量中删除前缀字母
- javascript - 动态合并不同数组中的所有对象(附加名称而不是忽略)
- swift - 如何在 SwiftUI 中使图像的容器宽度达到 100%?
- php - 将 JSON 数组数据导入 MySQL
- javascript - Javascript:减去迄今为止的日期。Today.getDate() 不是函数
- excel - Excel;如何提取更改的中间文本
- google-apps-script - Apps 脚本 - 在脚本的不同部分实现多个锁定
- php - 编码 if 和 counter 时遇到问题
- python - 在 Pandas 中将两列与 NaN 进行比较并获得差异
- excel - excel js 加载项清单要求部分