07-23-2023, 07:37 AM
I got the error because I didn't realize that the destination should be a file. I had a folder as the second parameter (which works in cmd). and I got `Unhandled Exception: System.UnauthorizedAccessException: Access to the path is denied.` because C# `File.Move` wants a file there, not just for the first parameter, but for the second too, and so if you put a directory as second parameter, it's trying to write a file like `c:\crp` when you have a directory called `c:\crp`.
this would be **incorrect** `File.Move(args[0],"c:\\crp");`
So, this would be **correct** `File.Move(args[0],"c:\\crp\\a.a");`
The same goes for `File.Copy`
this would be **incorrect** `File.Move(args[0],"c:\\crp");`
So, this would be **correct** `File.Move(args[0],"c:\\crp\\a.a");`
The same goes for `File.Copy`