I need to know the newest file in the entire folder and i am doing this
IList<FileSystemInfo> visibleThings = new List<FileSystemInfo>();
var dir = new DirectoryInfo(directory);
try
{
foreach (var item in dir.GetFileSystemInfos().Where(item => item.IsVisible()))
{
if(item.Extension == ".zip" ||item.Extension == null ||item.Extension == ""){
visibleThings.Add(item);
}
}
}
Maybe should i create a list and fill it with my item.CreationTime or something?