TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Dan
NA
23
8.5k
List Generic - get some files
Jun 27 2013 5:06 PM
I created a generic string list, in which I want to add files from two different locations: from C:\folder1 and from C:\folder2. The files that I want to add, have .pdf extension and as comparation, must be accessed today. This is my code:
List<string> PDFiles = Directory.GetFiles("C:\folder1\", "*.pdf", SearchOption.AllDirectories).Where(x => File.GetLastAccessTime(x).Date.ToShortDateString() == DateTime.Today.Date.ToShortDateString())
.Select(x => x)
.ToList();
Now how can I add the next files, from C:\folder2 path? (with the same extension and comparation )?
I tried something like this, but I don't know if is such a good idea:
foreach (var test in Directory.GetFiles("C:\folder2\, "*.pdf", SearchOption.AllDirectories).Where(x => File.GetLastAccessTime(x).Date.ToShortDateString() == DateTime.Today.Date.ToShortDateString()))
{
PDFiles.Add(test);
}
Reply
Answers (
7
)
hide browser while running selenium test using c# driver.
Filestream