Is there a method to read files by date modified ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
Lee Holsenbeck said:
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.
 
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
 
Scott said:
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.
 
Back
Top