Re: Finding the newest directory

From: Ben Morrow (usenet_at_morrow.me.uk)
Date: 05/13/04


Date: Thu, 13 May 2004 03:09:51 +0000 (UTC)


Quoth sholden@cs.usyd.edu.au:
> On Wed, 12 May 2004 22:52:42 -0400, sc0ri0n <sc0ri0n@hotmail.com> wrote:
> > Hi,
> >
> > If I have a bunch of directories and files (sun solaris). Is there a way to
> > find the newest directory (last one created not modified)?
>
> No (unless you are using a funky non-standard file system).
>
> Creation time is not tracked by the filesystem.
>
> You have (most recent) access time, modification time, and
> file status time. File status time (ctime) is as close as
> you'll get, but it is set by other operations that change
> the file status (such as chmod(), link(), unlink(), etc.)
>
> stat gives you access to the ctime.

...and you'll likely want File::Find to do the searching.

OTOH, you could probably do this more easily with find(1).

Ben

-- 
For the last month, a large number of PSNs in the Arpa[Inter-]net have been
reporting symptoms of congestion ... These reports have been accompanied by an
increasing number of user complaints ... As of June,... the Arpanet contained
47 nodes and 63 links. [ftp://rtfm.mit.edu/pub/arpaprob.txt] * ben@morrow.me.uk


Relevant Pages

  • Re: Finding the newest directory
    ... >> Creation time is not tracked by the filesystem. ... >> You have access time, modification time, and ... File status time (ctime) is as close as ...
    (comp.lang.perl.misc)
  • Re: Finding the newest directory
    ... You have access time, modification time, and ... File status time (ctime) is as close as ... stat gives you access to the ctime. ...
    (comp.lang.perl.misc)
  • Re: CTime runtime error - any progess?
    ... I've had lots of problems with CTime with attributes. ... one was it blew if there was an invalid date. ... > throwing an Exception after trying to convert the access time to a local ...
    (microsoft.public.vc.mfc)