mercredi 25 mars 2015

FTP: get the latest file in sever


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:


Home->T22:30:10->new.txt, and the latest one would be (a new folder)


Home->T23:10:25->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?



Aucun commentaire:

Enregistrer un commentaire