2016-08-04 112 views
-2

我有一個WPF客戶端應用程序。我試圖訪問c:\programdata\,我可以清楚地看到它是可用的。當我使用File.Copy()和c:\programdata\爲目標,我得到這個錯誤:「無法找到路徑的一部分」爲Windows客戶端

Could not find a part of the path

任何人都知道什麼是錯的?

+0

,你能不能給我們完整的錯誤? –

+0

找不到路徑的一部分'c:\\ programdata \\' – 4thSpace

+3

顯示您的代碼更多詳細信息 – Mostafiz

回答

3

File.Copy文檔指出destFileName是:

The name of the destination file. This cannot be a directory or an existing file.

你說你是路過C:\\programdata\\。這是一個目錄。你必須提供路徑和文件名。

例如:

File.Copy("C:\\programdata\\source.txt", "C:\\programdata\\dest.txt"); 
相關問題