in reply to Re^4: File creation and last modifiication time
in thread File creation and last modifiication time

Curious as I am (because I've no clue how to find the 'newest' file, or even how to define what the 'newest' file is), I clicked on the link. I somewhat expected to find how to find the file which was modified last (which, BTW, is something totally different from "newest"). But not even that. For me, the first link explained how to find the largest file,

Well, this article does indeed talk about finding the largest file, and then at the end says

So it explains how to sort files by date instead of size, and how to reverse the order. With a bit of thinking it's not too hard to combine those.

Oh, and I just assumed that "last file" meant something like "file with the latest creation timestamp".

this article (first hit on my other google query) explains how to obtain a creation date for a file.

Combine the wisdom of these articles should solve the OP's problem.

Your Google must be better than mine. Do you have the Platinum account?

It's not Google that's different.

Perl 6 projects - links to (nearly) everything that is Perl 6.
  • Comment on Re^5: File creation and last modifiication time

Replies are listed 'Best First'.
Re^6: File creation and last modifiication time
by JavaFan (Canon) on Aug 21, 2009 at 12:03 UTC
    Oh, and I just assumed that "last file" meant something like "file with the latest creation timestamp".
    Well, I would think that "last file" means "file last created". Now many file system do not have a creation timestamp, and for the filesystems that do, Perl doesn't have a dedicated way to access them.
    To get the oldest file, use -M instead of -s.
    -M has nothing to do with 'oldness' of a file. It has everything to do with last modification time. Which isn't the same as age of a file. As such, -M cannot be used to determine a directory's "oldest file".
      M has nothing to do with 'oldness' of a file. It has everything to do with last modification time. Which isn't the same as age of a file. As such, -M cannot be used to determine a directory's "oldest file".

      That's correct. And that's the reason why I also linked to the other google search which shows how to determine the creation time on windows.

      I never said that any of the google hits had the complete solution, I just want to point out that they give you enough material to solve the problem. Effort is still required, though.

      Perl 6 projects - links to (nearly) everything that is Perl 6.