private void RemoveFile(string filePath) { if (File.Exists(filePath)) { int maxReties = metadataConfiguration.GetFileOperationRetryCount(); int timeout = metadataConfiguration.GetFileOperationTimeout(); for (int i = 1; i <= maxReties; i++) { try { File.Delete(filePath); break; } catch (IOException) { if (i < maxReties) { Thread.Sleep(timeout); } else { throw; } } } } }