SUMMARY : deletion of old files

From: Maccy <maccy_at_maccomms.co.uk>
Date: Mon Oct 29 2001 - 12:05:42 EST
My sincere thanks go out to :-

Neill, Mark (MBS)
Mike Salehi
Daniel Azzarri
Buddy Lumpkin
Paul LaMadeleine
Frans Tigelaar
Dylan Northrup
todd.a.fiedler
dave floyd
ed.rolison
Chris Hoogendyk
David Evans
Edward Scown
Andy Bach

Most suggestions centred around the following (apart from read the man
page for 'find') :-

find /single-directory -ctime 60 -exec rm -f {} \;

This will delete all the files in "single-directory" that are older than
60x24 hours. If in doubt then use "ls -l" intead of the "rm -f" exec.

Oops. forgot. You can use 'mtime' twice in a find command.
thus:
find $DIR -mtime -10 -mtime +5 -exec rm {} \;
will find all files between 5 and 10 days old, and delete them.

My preferred solution was this script from Edward Scown :-

for file in `ls -al | awk '/Aug/ {print $9}'`
do
rm -f $file
echo "Removed $file"
done 

Many thanks to all who responded, or may yet respond :-)

Best regards,
Mark Mahabir

_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Mon Oct 29 09:10:27 2001

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:26 EST