Saturday, October 1, 2022

#1 2017-07-08 07:48:41 am

Registered: 2015-01-05
Posts: 16

Download File based upon Last Modification Date

Hi there,
I wanted to see if it were possible for me to have Apple script download a file from a web server, based upon it's last modification date. For instance, if a file was modified on April 1, 2000, the file probably isn't new and shouldn't be downloaded.
However, if the file was modified on July 12, 2017, then the file is to be downloaded.
The script should check for a file modification date, and if it is newer than the last time it was modified, for instance. The file was modified on July 12, 2017, and then again on July 20, 2017, the July 20th version is to be downloaded.
If the script download's a file, it should save it to the user's desktop. If the file in question is again modified with a new modification date, the file is to be replaced.
Is all of this possible with AppleScript and Curl? If so, I'd appreciate an example script.
The server runs on my LAN, and the file is called test.dmg, with an IP (as an example) of:



#2 2017-07-09 11:30:51 am

DJ Bazzie Wazzie
From:: the Netherlands
Registered: 2004-10-20
Posts: 2809

Re: Download File based upon Last Modification Date

Create an PHP script that send the modification date of the specific file and download it. Compare the date with the local file and if required download the file. Keep in min that once you download a file directly the file on your drive is not the same date as the file on the server. To correct this you can use touch to alter the modification data and synchronize it with the server.

But it seems like it's more important than the user uses the latest version of the file. In that case wouldn't comparing version numbers be easier rather than dates?



Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)