Re: WinSCP batch script is not is not downloading latest file
Replied
-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.
G3160V00
G3161V00
G3162V00
G3163V00
G3164V00
G3160V00
, where I'm expecting the latest G3164V00
not sure if it possible to download based on filename.
"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 'path_to_files.'" ^
"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%