It's been a couple of days I'm trying WinSCP.
Till now I've been using FileZilla but it doesn't support command line automation.
My usual tasks are searching for ZIP files by given name in a specific remote folder and its subdirectory.
It's unknown which subdirectory contains the file. For example:
I search for the latest version of file "FILE*.ZIP". The sure subdirectory where the ZIP files are to be searched is like "/main/files" and there might be a "FILE_V1.ZIP" in "/main/files/Jan", a "FILE_V2.ZIP" also in "/main/files/Jan" but a "FILE_V3.ZIP" might be in "/main/files/Mar", which is the latest version of the "FILE*.ZIP" that I'm searching.
The job until now could only be done in Filezilla manually by opening the "file search" window, set in the "/main/files" remote subdirectory and pressing the "search" button. Then I was getting a list of all the "FILE*.ZIP" files found in every subdirectory of every level, chose the latest version and download the file manually (flattening).
With WinSCP I managed to use the "get" command in cmd to download the latest version of a remote file from a specific subdirectory but -of course- there might be an even newest version in another subdirectory of the same or lower level.
The command I'm using is like this:
C:\Users\me\AppData\Local\WinSCP\WinSCP.com /log="C:\Users\me\AppData\Local\WinSCP\WinSCP.log" /ini=nul /command "open ftp://sitename:email@example.com/ -rawsettings ProxyPort=0" "cd /main/files/2018/01-1" "lcd C:\Users\me\Desktop" "get -latest File123*.zip" "exit"
There are "File123_V1" and "File123_V2" in "/main/files/2018/01-1" subdirectory but there is also "File123_V3" in "/main/files/2018/01" subdirectory which is -of course- omitted from the search.
So, could you please direct me how could I search for a file in all subdirectories by giving the part of its name?
Thanks in advance.