Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement