When I delete files manually using right click menu then it is deleted.
But when I run this code:
string[] filePaths = Directory.GetFiles(@"c:\My cloud\VM Instances\"); foreach (string filePath in filePaths) File.Delete(filePath); I got this error:
"A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll Access to the path 'c:\My cloud\VM Instances\i-7e3cbb19 (manish).cvm' is denied. The thread '' (0xb5c) has exited with code 0 (0x0). A first chance exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll 'cloud_sync.vshost.exe' (Managed (v4.0.30319)): Loaded 'C:\WINDOWS\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled."
So what should I do?