You can use any type of array or generic list object to track files you are removing. Here is a simple way to achieve this.
HashSet<string> deletedFiles = new HashSet<string>();
foreach (string fileSIPOS2 in Directory.EnumerateFiles(DirNameSIPOS2))
{
FileInfo fiSIPOS2 = new FileInfo(fileSIPOS2);
if (fiSIPOS2.LastWriteTime < DateTime.Now.AddDays(-DaytoDelete))
{
deletedFiles.Add(fiSIPOS2.FullName);
fiSIPOS2.Delete();
}
}
Console.WriteLine(deletedFiles.Count);
foreach(var entry in deletedFiles)
{
Console.WriteLine(entry);
}
</string></string>