lundi 2 mars 2015

Use system date as filenames for files being compared

I have a C# program that compares two existing csv files and outputs any changes as a new csv.


In the code, you can define which csv files to compare. Each day the csv files are saved in a folder as e.g. bags_02-03-2015.


I need to be able to set the filenames in the code so as to compare a csv file with today's date in the filename with a csv file with yesterday's date in the filename.


E.g.



public Form1()
{
InitializeComponent();

string fileName1 = "C:\\Users\\Example\\bags_(*TODAYSDATE).csv";
string fileName2 = "C:\\Users\\Example\\bags_(*YESTERDAYSDATE).csv";
string fileName3 = "C:\\Users\\Example\\bagcompared.csv";

...


Can anyone show me what I should be doing? I am somewhat new to C# so please be gentle.


Many thanks!


Aucun commentaire:

Enregistrer un commentaire