我试图复制服务器上的一个文件,但我得到的只是它的URI格式路径。
我一直在尝试在C#.NET 4.5中实现复制,但似乎CopyFile不适合处理URI格式。
所以我在shutil中使用了IronPython,但似乎它也不适合URI格式路径。在
如何在本地获取该文件?在
private string CopyFile(string from, string to, string pythonLibDir, string date)
{
var dateTime = DateTime.Today;
if (dateTime.ToString("yy-MM-dd") == date)
{
return "";
}
var pyEngine = Python.CreateEngine();
var paths = pyEngine.GetSearchPaths();
paths.Add(pythonLibDir);
pyEngine.SetSearchPaths(paths);
pyEngine.Execute("import shutil\n" +
"shutil.copyfile('" + from + "', '" + to + "')");
return dateTime.ToString("yy-MM-dd");
}
我从xml配置文件获取所有路径。在
用Python
^{}
您可以使用webclient,然后在特定文件夹中获取文件。在
或者,您也可以使用:
^{pr2}$HttpWebRequest
,因为您只想从服务器读取文件中的内容。在相关问题 更多 >
编程相关推荐