Reputation: 1977
What does this mean exactly? I'm doing something like this:
File.Copy(@"\\foo\bar\baz.txt", @"c:\test\baz.txt");
MSDN doesn't describe this exception except in general terms, and googling around just yields tables of error codes.
I've confirmed the source file exists, and I'm 99% sure that I have the permissions to copy the file to the destination location.
Upvotes: 3
Views: 2609
Reputation: 5128
By default local evaluation of remote symbolic links is disabled.
You could use fsutil to change that setting or you could delve into unmanaged code and resolve the link yourself.
Upvotes: 1
Reputation: 22320
Check this article for some information about using symlinks in .Net: "Manipulating NTFS Junction Points in .NET".
According to this article:
"In particular the .NET libraries does not include any functionality for creating or querying properties of Junction Points"
But there is a method how to actually get the target of the symlink, and then you'll be able to use File.Copy with it.
Upvotes: 2
Reputation: 3480
You will get this error if the destination file already exists. I would also confirm that the account you're running the code under has access to the UNC \foo\bar\baz.txt
Upvotes: 0