如何基于WinSCP的上传结果将文件批量移动到不同的文件夹中

问题描述 投票:1回答:1

我是WinSCP的新手。我正在尝试为批处理IM运行设置错误级别。如果Errorlevel = 0,则PRINT SUCCESS并将那些错误级别为0的文件传输到文件夹调用成功。如果错误不等于0,则将错误级别的文件移动到其他文件夹调用错误。有任何建议。

HERE是MY.bat

WinSCP.exe /console /script="c:\users\PDP\script.txt" /log="c:\users\PDP\lastrun.txt"
if %ERRORLEVEL% equ 0 
echo Success
sendmail.exe -t < success_mail.txt
move OPTTXM* c:\users\PDP\sent  ( the files in the batch start with OPTTXM*)
exit /b 0

 if %ERRORLEVEL% neq 0  goto error

echo Error!
sendmail.exe -t < error_mail.txt
move  ????????????????????????????????? ( how you can get inside each file and check the status
)
exit /b 1

提前感谢

batch-file winscp
1个回答
0
投票

您可以使WinSCP使用已传输和尚未传输的文件创建XML log。但是很难(如果可能的话)解析/处理批处理文件中的这些XML文件。

您最好使用功能更强大的脚本语言,例如PowerShell。参见例如Move files after upload using PowerShell/WinSCP Script。(这里还有许多其他类似的问题)

[还有关于此主题的WinSCP文章:Moving local files to different location after successful upload

© www.soinside.com 2019 - 2024. All rights reserved.