C# 存在的文件的FileNotFound异常
我正在尝试将文件从特定结构复制到更具归档性的格式C# 存在的文件的FileNotFound异常,c#,.net,C#,.net,我正在尝试将文件从特定结构复制到更具归档性的格式 foreach (string line in lines) { if (line.Contains("INSERT INTO BACKLOGITEM_ATTACHMENT VALUES")) { string AttachementID = line.Split(',', ')')[1];
foreach (string line in lines)
{
if (line.Contains("INSERT INTO BACKLOGITEM_ATTACHMENT VALUES"))
{
string AttachementID = line.Split(',', ')')[1];
string FileName = AttachementsDictionary[AttachementID];
string BacklogAttachementScrumID = BacklogLookupDictionary[AttachementID];
BacklogItem Story = BacklogItemDictionary[BacklogAttachementScrumID];
Product Product = ProductDictionary[Story.ProductScrumId];
string FileToCopy = "C:\\attachments\\product" + Story.ProductScrumId + "\\attachement" + AttachementID;
string FileToSave = "C:\\ScrumWorksAttachementExport\\" + Product.ProductName + "\\" + Product.StoryPrefix + "-" + Story.StoryTitle + "\\" + FileName;
File.Copy(FileToCopy, FileToSave);
}
}
我收到一个文件未找到异常:
但文件位置是正确的:
为什么File.Copy()无法移动看似存在的文件?异常中的文件名中有一个额外的“e”:“attachement10341”。文件系统没有:“attachment10341”。异常中的文件名中有一个额外的“e”:attachement10341。文件系统没有:“attachment10341”。lol。你在阅读答案时一定笑了。我的傻瓜帽在哪里?@DavidTunnell我自己的傻瓜帽太旧了,它也有自己的漏洞。:)哈哈。你一定是在读答案的时候笑了。我的傻瓜帽呢?@DavidTunnell我自己的傻瓜帽太旧了,它也有自己的虫子。:)