How to check which file is older

Is there a command in Mathematica to check the date when a file was last modified? Suppose I have two notebooks: File1.nb and File2.nb, I need a way to find out which notebook is older. If no such command exists is there a way to do this in Mathematica regardless of the operating system we are working on?

-

You are looking for FileDate.

-
lol, I feel dumb now. I had been looking all over google for it but forgot to put it in the documentation center. What is more embarrassing, is that the tag for the question is all I had to put in the documentation center to find the answer (It took me a while to think of the tag too). –  jmlopez May 19 '12 at 0:36
@jmlopez I started my search with FileNames which had a link to File Operations, and under File Properties was FileDate. –  rcollyer May 19 '12 at 0:38

Here are some commands I ran on my machine to generate a few files, and give them some history:

touch foo1 foo2 foo3 foo4
touch foo3
cat foo2


Here are the files:

files = FileNames["foo*"]

(*
==> {"foo1", "foo2", "foo3", "foo4"}
*)


The most recently changed file:

SortBy[files, FileDate] // Last

(*
==> "foo3"
*)


SortBy[files, FileDate[#, "Creation"] &] // Last

(*
==> "foo4"
*)


The most recent file that was looked at:

SortBy[files, FileDate[#, "Access"] &] // Last

(*
==> "foo2"
*)

-
What my answer should have looked like, +1. –  rcollyer May 19 '12 at 3:11
@rcollyer yet another example of why we need collaborative answers. –  Mr.Wizard May 19 '12 at 9:52
@Mr.Wizard, I think the collaborative answers should be implemented. Is someone working on this? –  jmlopez May 19 '12 at 17:57
@Mr.Wizard they do exist, in a way: community-wiki. But, not in the sense your thinking of. –  rcollyer May 19 '12 at 21:26
@jmlopez as far as I know: not at this time. I am hoping to built interest in this possible feature, at which time the devs may consider it. –  Mr.Wizard May 19 '12 at 22:48