2014年7月13日 星期日

[RESOLVED] Fetch file between two time


I have a folder in my computer that contains .wav files(Name of File contains Time).


Now i want to make a utility that fetch the files between two time(e.g. from : 10:10:50  To : 3:00:06) to another folder. I have two textbox for taking input as from and to time.  And one destination folder path.



Hi,


For this situation, to get the file names from a folder, you could use the DirectoryInfo.GetFiles method:


 System.IO.DirectoryInfo downloadedMessageInfo = new DirectoryInfo(Label1.Text);

foreach (FileInfo file in downloadedMessageInfo.GetFiles())
{
Response.Write(file.Name+"
");
//You could use split() function to separate the filename into different parts,then get the time, and check whether it is between 10:10:50  To : 3:00:06
//file.Delete(); //would delete the file within the folder
}

For split() function, you could refer to:


http://www.dotnetperls.com/split


http://msdn.microsoft.com/en-us/library/system.string.split.aspx


Regards


沒有留言:

張貼留言