How do I delete a read-only file?

According to File.Delete’s documentation,, you’ll have to strip the read-only attribute. You can set the file’s attributes using File.SetAttributes().

using System.IO;

File.SetAttributes(filePath, FileAttributes.Normal);
File.Delete(filePath);

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)