Retrieve the Latest file in a folder using SFTP

HI Guys,

Can anyone help me to retrieve the latest file from below example using SFTP

I have below list of files in a folder

v403t.lstprgms.sortin1
val027.d099.fwest.oct2711
xcelrptd.d1400sqp.dec1713.t040459.@02del
xcelrptd.d1400sqp.dec1713.t073308.@02del
xcelrptd.d1400sqp.dec1713.t083000.@02del
xcelrptd.d1400sqp.dec1813.t040421.@02del
xcelrptd.d1400sqp.dec1813.t073312.@02del
zions.s2550nai.jan0819
zions.s2550nai.jan0919
zions.s2550nai.jan1019
zions.s2550nai.jan1419
zions.s2550nai.jul3018
zions.s2550nai.jul3118
zions.s2550nai.jun1518
zions.s2550nai.jun2918

I need to get latest file that start with filename zions.s2550nai.* by using SFTP
So from above list I need to get only zions.s2550nai.jan1419 (MONDDYY format)

Any thoughts are highly appreciated

Do it in two steps. First connection, just issue 'ls -ltr' and save the output to a file. Second examine the file and create an sftp script to retrieve the one required file
Sorry for the typos. On my phone.

You seem to imply that the filetime (Last time the file was written) kept by UNIX is not what you want, but the "date" kept in the filename? Is that correct?

This should give you a good starting point.

jack@veritron ~ $ f=zions.s2550nai.jan0819
jack@veritron ~ $ d=$(echo $f|cut -f3 -d".")
jack@veritron ~ $ echo $d
jan0819
jack@veritron ~ $ m=$(echo $d|cut -c1-3)
jack@veritron ~ $ echo $m
jan
jack@veritron ~ $ day=$(echo $d|cut -c4-5)
jack@veritron ~ $ echo $day
08


jack@veritron ~ $ y=$(echo $d|cut -c6-7)
jack@veritron ~ $ echo $y
19
jack@veritron ~ $ date +"%s" --date="$m $day 20$y"
1546923600

Do this for each file and select the one that returns the highest value.