What code would i need to use in order to download a file from a webserver and then save it to a predefined folder?
Then if a newer version of the file is available, Rename the old file and download the new one.

Thansk for the help

to download from ftp you can use this

my.computer.network.download(ur ftp address+filename,username,password,destination folder+filename)
'as i just typed it here so may be the sequence of parameters may be different. so please advance sorry for this.

Regards

There are a couple ways of downloading. One is to use the method above. Or, you can use the WebClient component.

' Rename a file

' check if file exist
If System.IO.File.Exists("MyFileName") Then
    ' move the file (rename)
    ' there is no "Rename" in .NET
    ' move actually renames he file.
    System.IO.File.Move("MyFileName", "MyOldFileName")
End If

' Now that we have the file renamed. Download the new file.
Dim WebClient As New System.Net.WebClient
WebClient.DownloadFile("MyAddress/MyFilename", "MyFileName")
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.