This is really really pain in the ass. I have a ftp server running, and it irregularly generates the latest file. The file is store as:
new.txt, and the latest one would be (a new folder)
new.txt (note that this is a new folder with latest time)
I need to implement something (it could be anything, C code, bash script, etc) in a Linux machine that pull the latest file over.
I have look into two options:
Option 1. Use libcurl, pass the directory listing, and select the latest file. This is really pain in the ass and time-consuming and I still can't find a easy way to do this.
Option 2. Use lftp, at initiazation, remove all the files in the server, so that each time when I call lftp to download something, it would be the latest one. (This method is only idealization and I haven't tried in real life).
Is there any easier option?