WinSCP batch script is not is not downloading latest file

Advertisement

mar052y
Joined:
Posts:
1

WinSCP batch script is not is not downloading latest file

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 '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%

Reply with quote

Advertisement

Advertisement

You can post new topics in this forum