I am thinking that this is big problem ….
I have path like this…”C:\restore\restoredb\”
In that path i have files like this..
restore-2011-10-12T17-16-51.zip
restore-2011-10-11T13-24-45.zip
restore-2011-05-11T09-45-56.zip
restore-2011-08-11T09-08-07.zip
restore-2010-09-11T09-45-12.zip
I have a form , in that form i have a listbox and combobox(cbrestore)
I have got the combobox items like this …Month, 3 months,6 months,year…
what i want is , if i select the combobox item(month) i want to display the file names which are stored in that folder between these dates (12-10-2011 to 12-09-2011)..
If i select combobox item(3 months) i want to display the file names which are stored in that folder between these dates (12-10-2011 to 12-07-2011)..in listbox
For that i have tried this ….
private void cbrestore_SelectedIndexChanged(object sender, EventArgs e)
{
string fullpathforfiles = @"C:\restore\restoredb\";
string[] allfiles = Directory.GetFiles(fullpathforfiles);
foreach (string single in allfiles)
{
string filenameonly = Path.GetFileName(single);
}
if (cbrestore.SelectedValue == Daterange.type1)
{
}
}
struct Daterange
{
public const string type1 = "Month";
public const string type2 = "3 Months";
public const string type3 = "6 Months";
public const string type4 = "Year";
}
I dont know how to extract the exact part in that filename and adding that …
any idea how can i do this .. pls ..
Any suggestions and any code sample snippet would be very greatful to me ….
Many thanks…..
I’d do it like this:
The Result is this :
EDIT: Fixed the month problem select you see in the SS and added the year select.