Re: oldest and newest file/directory within a directory structure



Thanks for your input. It has given me an idea for one way to approach
this:

I could create a loop that performs a find on the directory structure
and keep incrementing the mtime value as long as data is being returned.
Hmmm... not pretty but, it would probably provide the functionality that
I am looking for.

Thanks

Davids

-----Original Message-----
From: IBM AIX Discussion List [mailto:aix-l@xxxxxxxxxxxxx] On Behalf Of
N. Leenders
Sent: Saturday, September 23, 2006 8:48 PM
To: aix-l@xxxxxxxxxxxxx
Subject: Re: oldest and newest file/directory within a directory
structure

Here is a script (careful, it has wrapped), that gets rid of older files

in /tmp that don't belong to certain users. It makes use of the
opensource find utility. Different versions of "find" may behave a
little
differently. Maybe you can make use of "find" for your purposes too.

#!/usr/bin/ksh
# clean /tmp
/opt/freeware/bin/find /tmp -type f -mtime +32 ! -user 0 ! -user 202 !
-user 222 -exec rm -f {} \; > /dev/null 2>&1
/opt/freeware/bin/find /tmp -type l -mtime +32 ! -user 0 ! -user 202 !
-user 222 -exec rm -f {} \; > /dev/null 2>&1
/opt/freeware/bin/find /tmp -type d -mtime +32 -empty ! -user 0 ! -user
202 ! -user 222 -exec rm -rf {} \; > /dev/null 2>&1
/opt/freeware/bin/find /tmp -type p -mtime +32 ! -user 0 ! -user 202 !
-user 222 -exec rm -f {} \; > /dev/null 2>&1


Nadine Leenders
HPC System Administrator, Research Support
Academic Information and Communication Technologies
University of Alberta


On Fri, 22 Sep 2006, Taylor, David wrote:

Hi *,



Does anyone know of a way to find the oldest and newest file within a
directory structure - to include subdirectories too?



I am writing a script to do some reporting on various directories
(size,
# of files, # of directories, etc..) and would also like to be able to
identify the oldest and newest file within each directory structure
too.



TIA



David




**********************************************************************
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.clearswift.com
**********************************************************************






Relevant Pages