We can check if the file is used by another process
try { using (FileStream fs = File.Open(FilePath, FileMode.Open, FileAccess.ReadWrite, FileShare.None)) { fs.Close(); } // The file is not locked } catch (Exception ex) { ErrorMsg = "File is locked by another process.!"); }