I have lots of logs in a folder, I would like to only grab files that have todays date and put them in the zip file.
Here is my code:
static void Main(string[] args)
{
//Specify todays date
DateTime todaysDate = DateTime.Today;
//Create a zip file with the name logs + todays date
string zipPath = @"C:\Users\Desktop\ZIP\logs" + todaysDate.ToString("yyyyMMdd") + ".zip";
string myPath = @"C:\Users\Desktop\LOG SEARCH";
var files = System.IO.Directory.GetFiles(myPath, "*" + todaysDate.ToString("yyyyMMdd") + "*");
foreach (var file in files)
{
Console.WriteLine(file);
}
}
How do I zip files
?