Files download using wget

Hi,
I need to implement below logic to download files daily from a URL.

* Need to check if it is yesterday's file (YYYY-DD-MM.dat)
  * If present then download from URL (sample_url/2013-01-28.dat)
  * Need to implement wait logic if not present 
  * if it still not able to find the file after specific wait then need to send email notification
  * would be great if it can still able to pull 2 files in next day's processing i.e missing file for day before yesterday & yesterday file.
eg: Process date 2013-01-29   files expecting 2013-01-28.dat (but could not find it that day)
Next day it should look for 2 files 2013-01-28.dat & 2013-01-29.dat

Now that we all know what the 'need' is, what exactly is the issue?