Tuesday, 26 April 2016

Using curl in Windows to download files

This downloads a file if it's newer than the one that's on your local drive:

curl -z "path\filename.lib" ftp://ftp.yoursite.com//ftppath/filename.lib -o "path\filename.lib"

The "-z" means only copy if it's newer than a specified date. But then you just put the filename, meaning that curl should use the date of that file.
If the file doesn't exist locally, you'll get a warning about "invalid date or not a file". This can be ignored.
The "-o" means download it to the local file specified (same filename as for -z), instead of just outputting it to the console.