|
From: | formes01 |
Subject: | Re: [Bug-wget] downloading a file from a web (updated every 24 hours) |
Date: | Tue, 09 Dec 2008 17:23:46 +0500 |
User-agent: | Opera Mail/9.62 (Win32) |
hours on the server. What I would like to do is to add a -wget- bat file in the startup menu of windows, and then, every time I start the computer the -wget- should (1) check with the file on the server and see if a copy has been downloaded; if not, download the file and keep it.
Bash script can help you. Example(for it to run on Windows you need the following cygwin packages: cygwin, coreutils, wget and either associate .sh extension with bash, or create a shortcut to bash with a parameter):
=========================== fn=<YOUR_FILE_NAME> url=<URL_OF_YOUR_FILE> if [ \ "`date -u -r <YOUR_FILE> +' Last-Modified: %a, %d %b %Y %X GMT'`" \ != \ "`wget -S --spider $url 2>&1 | grep Last`" \ ]; then mv $fn `date +'%m%d%y'`-$fn wget $url ; fi =========================== Assuming the file already exists in current directory.This script compares last modification time of <YOUR_FILE> and <URL_TO_YOUR_FILE>. If they're not equal, existing file is renamed and a new file is downloaded.
[Prev in Thread] | Current Thread | [Next in Thread] |