I have a String Path to output a .ZIP file String path = @"C:\TEMP\test.zip";
and I am looking to five the file name a date stamp. Example, test_TodayDate.ZIP.
There's a way to achieve this?
Thanks
You can create your own variable, like this,
// gets the file name without extension
var fileName = Path.GetFileNameWithoutExtension(path);
// create the new file name
var newFileName = fileName + "_" + DateTime.Now + ".zip";
Now save the new file generated, and name this file as the newFileName
it will have the DateTime in the name.
You can do: