2017-03-15 102 views
0

我有文件夾存儲在解決方案文件夾中的調試,但是當我嘗試將此文件夾複製到另一個「拒絕訪問目錄」異常,任何人都可以幫助嗎?訪問目錄路徑被拒絕

if (!System.IO.Directory.Exists(@"Exported Files")) 
{ 
    var di = new DirectoryInfo(@"SBooks"); 
    di.Attributes &= ~FileAttributes.Directory; 
    System.IO.File.Copy(@"SBooks", @"Exported Files\\"); 
} 
+0

你用什麼技術?網頁表單? MVC? WPF? WinForm的? etc – Valkyrie

+2

可能重複的[無法複製文件,訪問路徑被拒絕](http://stackoverflow.com/questions/7130136/unable-to-copy-file-access-to-the-path-is-denied ) – jjj

+0

windows窗體應用程序,文件中沒有重複 – Hesham

回答

0

使用一個反斜線,如果你使用的是@(見this)。

File.Copy(@"SBooks", @"Exported Files\")