Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / September 2005

Tip: Looking for answers? Try searching our database.

Is there a method to read files by date modified ?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Lee Holsenbeck - 29 Sep 2005 21:08 GMT
i have been using the getfiles method, but that retrieves only
alphabetically. i'd like to be able to retrieve filenames in a directory by
thier date modified.
does .net have a method for this ?
the closest i can see is to use the file system object.

thanks in advance,
Lee
Daniel O'Connell [C# MVP] - 29 Sep 2005 22:17 GMT
> i have been using the getfiles method, but that retrieves only
> alphabetically. i'd like to be able to retrieve filenames in a directory
> by
> thier date modified.
> does .net have a method for this ?
> the closest i can see is to use the file system object.

You'll probably have to just get the FileInfo objects and sort the
collection yourself. Shouldn't be too hard.
Scott - 30 Sep 2005 08:53 GMT
Seems to me you could create a class implementing the "IComparer" interface,
put all your FileInfo's into an arraylist then call the
ArrayList.Sort(IComparer) method to get the work done cleanly.

Scott

>> i have been using the getfiles method, but that retrieves only
>> alphabetically. i'd like to be able to retrieve filenames in a directory
[quoted text clipped - 5 lines]
> You'll probably have to just get the FileInfo objects and sort the
> collection yourself. Shouldn't be too hard.
Daniel O'Connell [C# MVP] - 30 Sep 2005 22:06 GMT
> Seems to me you could create a class implementing the "IComparer"
> interface, put all your FileInfo's into an arraylist then call the
> ArrayList.Sort(IComparer) method to get the work done cleanly.

yeah, that is probably the best way to do it.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.