Re: oldest file in a filesystem

From: cbaker@GOODYEAR.COM
Date: Thu Apr 29 2004 - 13:58:27 EDT


Dave,

You could do a

      find . -type f -mtime +SOME_NUMBER -ls

and then play with that SOME_NUMBER of days until you get a manageable list of the oldest files.

Or

You could make a for loop like this

for dir in `find . -type d -print`
do
   ls -lart $DIR | egrep -v "^total|\.|\.\." | head -1
done

And you could echo the $DIR or append it to the file name.

Could go a step further and write to a file and then sort the results of the oldest file per subdir to get the oldest file of them
all.

Of course there are better/cleaner ways to skin this cat.

Christopher M. Baker
Senior Technical Support Analyst
DSE/TCO
Goodyear Tire and Rubber Company

=================================================
Contains Confidential and/or Proprietary Information.
May not be copied or disseminated without the expressed
written consent of The Goodyear Tire & Rubber Company.
=================================================

                      "Taylor, David"
                      <DTaylor@WBMI.CO To: aix-l@Princeton.EDU
                      M> cc: (bcc: Chris Baker/NA/GDYR)
                      Sent by: IBM AIX Subject: Re: oldest file in a filesystem
                      Discussion List
                      <aix-l@Princeton
                      .EDU>

                      04/29/04 10:59
                      AM
                      Please respond
                      to IBM AIX
                      Discussion List

      Both of these suggestions only sort, by age, at the directory-level. This file-system has ~2000 directories in it. I need to
      find the oldest file in the entire file-system.

      David

      -----Original Message-----
      From: IBM AIX Discussion List [mailto:aix-l@Princeton.EDU] On Behalf Of Renison, Rick
      Sent: Thursday, April 29, 2004 9:20 AM
      To: aix-l@Princeton.EDU
      Subject: Re: oldest file in a filesystem

      ls -Rrlt /fs | head

      works really fast.

      Rick Renison, EDS Canada, DuSC, Oshawa, Ontario
      There's no place like 127.0.0.1
      + mailto:rick.renison@eds.com
            -----Original Message-----
            From: IBM AIX Discussion List [mailto:aix-l@Princeton.EDU] On Behalf Of Taylor, David
            Sent: April 29, 2004 9:53 AM
            To: aix-l@Princeton.EDU
            Subject: oldest file in a filesystem
            Hi *

            I am trying to trouble-shoot a problem with cache-corruption on an imaging system. It would be very helpful if I could
            locate the oldest file (modified or created) in that cache. Does anyone know of a script that would do this? The cache
            is about 35GB in size and the average file size is ~ 100K.

            The corruption is definitely application-related. We would just like to pinpoint the point in time that it began in order
            to discover the root cause.

            TIA

            David Taylor

            **********************************************************************
            This email and any files transmitted with it are confidential and
            intended solely for the use of the individual or entity to whom they
            are addressed. If you have received this email in error please notify
            the system manager.

            This footnote also confirms that this email message has been swept by
            MIMEsweeper for the presence of computer viruses.

            www.mimesweeper.com
            **********************************************************************

**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:52 EDT