User Id :    Password :      New Member   Forgot Password  
Search files based on created date in c-sharp
Description Search files based on created date in c-sharp   No. of Views     2901
  Rating     0
Author Shaheen   Posted On     03 Mar 2014
Tags C#    

Sample Code   Download Code

Sometimes we need to search files based on the their creation date. So here is the code for file search in a date range.

public void GetFiles(DateTime dateFrom, DateTime dateTo, string folderPath)
                DirectoryInfo info = new DirectoryInfo(folderPath);
                FileInfo[] matchedFiles = info.GetFiles().Where(p=>p.CreationTime >=dateFrom && p.CreationTime<=dateTo).OrderBy(p => p.CreationTime).ToArray();

                foreach (var file in  matchedFiles)
                    // DO stuff




About Author

About Author Coding is as cool as cooking......... Shaheen
No Photo
Country India
Company DotNetLogix
Home Page

Rate this article

Rating options from poor, fair, good, very good to excelent.  


Write your comment here.
Verification Code