GET newest FTP file?
Is there a way to get the most recent file that matches a pattern?
some days multiple files are created and I need the newest one...
example
WIN_APF_03092020100544.csv
WIN_APF_03092020021851.csv
WIN_APF_03092020040213.csv
I use pattern WIN_APF_03092020* to get the current day file (but using the current date and building the string)... because most days there is only one file so the rest of the number doesnt matter.
On days with multiple, the extra number is actually the time, in 12 hr format... so the 2nd and 3rd listed are actually PM...(02:18:51 & 04:02:13).. currently I am breaking apart the number and rebuilding it as a 24hr number then sorting to get the latest. this SHOULD work, only if no one ever creates the file AFTER 10pm..
So, is there a way to do this? once you FTP get, the create date becomes now, so the dir list node shows them all as the same time.
Thanks!
Please sign in to leave a comment.
Comments
0 comments