I have a program that does different things my questions is related to access files in a network mapped drive or a shared folder
the program can run a file msi/exe from the network (network mapped drive or a shared folder) the program can copy file from the network (network mapped drive or a shared folder)
how I can check if the files are accessible before I try to run or copy (in case of a network disconnection, or any other network problem)?
is it enough with File.Exists();
here is an example of my code:
public static bool FileIsOk(string path)
{
try
{
FileInfo finfo = new FileInfo(path);
if (finfo.Exists)
{
return true;
}
MessageBox.Show("file does not exist, or there is a problem with the network preventing access to the file!");
return false;
}
catch (Exception e)
{
MessageBox.Show(e.Message);
}
return false;
}
thanks