private void SaveUrlFileData(string url, string destination, bool overwrite = false)
{
var fileParts = url.Split(new[] {'/'}, StringSplitOptions.RemoveEmptyEntries);
destination = string.Concat(destination, "\\", fileParts.Last());
using (WebClient client = new WebClient())
{
client.ForgeHeaders();
Console.WriteLine($"Downloading {destination}");
if ((overwrite && File.Exists(destination)) || !File.Exists(destination))
{
client.DownloadFile(url, destination);
}
}
}
Comments