I'm trying to get the most recent file from an SFTP server without using a loop as the number of files in the directory is thousands (and growing). The file names takes the following format: filename_date.xml
(where filename
can be any name and date
is in the format yyyymmdd_hh.mm.ss
).
According to the docs listdir()
and listdir_attr()
return a list of all files in arbitrary order so this isn't much help.
EDIT:
Further to the above I cannot execute shell commands, if I try to run a script using exec_command
I get This service allows sftp connections only.
.