How to delete the old excel file from a folder

Hi @HeartCatcher

Loop each excel files from folder
Directory.GetFiles(“\10.1.2.82\Software Data\Automation\NaveenKumarS\ModmedInventory\ModmedRejection28092022”,“*.xlsx”)

in if condition (Directory.GetCreationTime(item.ToString).ToShortDateString.CompareTo(now.date.AddDays(-4).ToShortDateString))=-1