string remoteUri = System.IO.Path.GetDirectoryName(url);
string fileName = System.IO.Path.GetFileName(url);
string myStringWebResource = null;
WebClient myWebClient = new WebClient();
myStringWebResource = url;
if (!System.IO.Directory.Exists(@"E:\BIM_APP\ModelFile"))
{
System.IO.Directory.CreateDirectory(@"E:\BIM_APP\ModelFile");//不存在就创建文件夹
}
myWebClient.DownloadFile(myStringWebResource, @"E:\BIM_APP\ModelFile\" + fileName);
string fullfile = @"E:\BIM_APP\ModelFile\" + fileName;
if (File.Exists(fullfile))//判断文件是否存在
{
下载成功
}
else
{
下载失败
}