c# - Download pdf file with incrementing filename -


I need to download a PDF from the internet on a scheduled basis. Usually I use the command line function for this, but it's probably a turn. The file I need to download is not always the same name. This is a weekly publication that has been published online, in fact this is set.

This is the file path for this week

  http://www.website.com/newsletter1of2014.pdf  

next week It will

and so on and even further.

So how can I set some to download these files automatically, once it reset for the first time 1 and keeps changing for one year 2015?

I have some experience in C # programming and, if necessary, not above the writing of console applications to do this work.

Some things like

  constant string BASE_URL = "http: /www.website.com/ "; Const string FILE_NAME = "{1} .pdf newsletter {0}"; Var stringLastNumber = file. Read all the text ("lastnumber.txt"); Var lastNumber = Convert toInt32 (stringLastNumber); Var thisFileName = String.Format (FILE_NAME, final number ++, datetime.now.year); Var uri = New Uri (String.Concat (BASE_URL, thisFileName)); File. Write all text ("Final number. TX", last number.tostring ()); (Var Client = New Web Client ()) is using (client.DownloadFile (uri, thisFileName);}  

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -