public static void DeleteEvenIfReadOnly(string filePath) { File.SetAttributes(filePath, FileAttributes.Normal); // Might have been made read-only. File.Delete(filePath); }