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
darma teja
NA
496
337.6k
latest and oldest file in a directory
Apr 2 2013 12:05 PM
Hi all,
How to get latest and oldest file in a directory including filter file extension.
I have different files with different file extension in my directory including sub directories.
for example:
in "c:\Darmateja\"
files:
ab.xml created date: 10.10.2010 9:00 AM
cd.xml created date: 10.10.2010 5: 00 PM
ef.xml created date: 10.10.2011 5:00 PM
gh.xls
ij.xls
Now i want to get all files excluded ".xls". I wrote code like this: I am getting all xml file with this code.
Directory.EnumerateFiles(mypath2, "*.*", SearchOption.AllDirectories).Where(n => Path.GetExtension(n) != ".xls").ToList();
Now I want to get latest created dated file and oldest created dated file. How can i do it?
My out put should be :
ab.xml ------10.10.2010
ef.xml ------10.10.2011
Many Thanks
Darma
Reply
Answers (
2
)
I want code of c#.net
change text for Yes, No, Cancel buttons