We have a service that does something similar to the following:
var dir = @"\\network-fileshare\logs\special\1";
var anotherDir = @"\\network-fileshare\logs\1";
if (Directory.Exists(dir))
{
Directory.Move(dir, anotherDir);
}
It sometimes throws a DirectoryNotFoundException
when moving the directory, saying that it "Could not find part of the path" for the directory we're trying to move (ie dir
).
What baffles me is:
Are there any other potential causes of a DirectoryNotFoundException
?
Network issues might cause this problem as well. You can consider using Mapped Network Drive letters but based on my experience, it's really hard to solve it unless you redesigned network structure. Anyway, it's just my opinion.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.