0

I have folder stored in Debug inside the Solution Folder, but when i try to copy this folder to another one an "Access to the directory is denied" exception, can any one help?

if (!System.IO.Directory.Exists(@"Exported Files"))
{ 
    var di = new DirectoryInfo(@"SBooks");
    di.Attributes &= ~FileAttributes.Directory;
    System.IO.File.Copy(@"SBooks", @"Exported Files\\");
}
Patrick Hofman
  • 153,850
  • 22
  • 249
  • 325
Hesham
  • 41
  • 6

1 Answers1

0

Use one backslash if you are using @ (see this).

File.Copy(@"SBooks", @"Exported Files\")
Community
  • 1
  • 1
Sinatr
  • 20,892
  • 15
  • 90
  • 319