Код: Выделить всё
static void Main(string[] args)
{
var appFolder = Path.GetDirectoryName(Environment.ProcessPath)!;
var path = Path.Combine(appFolder, "a.txt");
var fi = new FileInfo(path);
fi.Create().Close();
fi.Refresh();
PrintFileInfo(fi);
// Delete here OR using external file manager
fi.Delete();
fi.Refresh();
Console.WriteLine("File deleted" + Environment.NewLine);
PrintFileInfo(fi);
}
private static void PrintFileInfo(FileInfo fInfo)
{
Console.WriteLine($"Name: {fInfo.Name}");
Console.WriteLine($"File exists?: {fInfo.Exists}");
Console.WriteLine(fInfo.LastWriteTime.ToString());
Console.WriteLine();
}
Подробнее здесь: https://stackoverflow.com/questions/797 ... e-deletion
Мобильная версия