WINSCP批处理不是不是下载最新文件
我正在使用“ -latest”开关,但它仅下载最旧的文件,而不是最新的“最新”。文件文件按上升顺序,新文件/生成为+1,请参见下面的示例。
文件 G3160V00 G3161V00 G3162V00 G3163V00 G3164V00
当前我运行脚本时,它下载了最古老的“ G3160V00”,我期望最新的“ G3164V00”不确定是否可以根据文件名下载。
当前脚本:
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="C:\FTPtemp\FTPtesting\WinSCP.log" /ini=nul ^
/command ^
"open ftp://user:password@sc01/ -rawsettings ProxyPort=0" ^
"cd 'KINP.EDI.BI04801.'" ^
"lcd C:\FTPtemp\FTPtesting" ^
"get -latest *" ^
"exit"
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)
exit /b %WINSCP_RESULT%
这是移至WINSCP之前使用的脚本,该脚本仅下载最新文件。
@ftp -s:"%~f0"&GOTO:EOF
open sc01
user
password
lcd C:\FTPtemp\FTPtesting
prompt
cd ..
cd KINP.EDI.
mget BI04801(0)
bye
I'm using the "-latest" switch but it's only downloading the oldest file rather then latest "newest". Files file are in ascending order, ever new file/generation is +1 see sample below.
Files
G3160V00
G3161V00
G3162V00
G3163V00
G3164V00
Currently when I run the script it downloads the oldest "G3160V00", where I'm expecting the latest "G3164V00" not sure if it possible to download based on filename.
Current script:
"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
/log="C:\FTPtemp\FTPtesting\WinSCP.log" /ini=nul ^
/command ^
"open ftp://user:password@sc01/ -rawsettings ProxyPort=0" ^
"cd 'KINP.EDI.BI04801.'" ^
"lcd C:\FTPtemp\FTPtesting" ^
"get -latest *" ^
"exit"
set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
echo Success
) else (
echo Error
)
exit /b %WINSCP_RESULT%
This is the script used before moving over to WinSCP, this one would download only the latest file.
@ftp -s:"%~f0"&GOTO:EOF
open sc01
user
password
lcd C:\FTPtemp\FTPtesting
prompt
cd ..
cd KINP.EDI.
mget BI04801(0)
bye
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论