SUMMARY: Using find to remove files

From: Grant Lowe <glowe_at_skydesk.com>
Date: Mon Oct 15 2001 - 09:09:03 EDT
Hi gurus.

Here's my summary.  First, I can't believe the overwhelming response.  I got
so many replies and in such a short period of time.  Thanks to everybody.
Too many people to personally say thanks to.

Well, the replies fit into one of about 4 categories:

The first and most popular response was to use find with something like
this:

find . -mtime 6 | xargs rm

Problem with using this is that the 6 with find uses days, not minutes.  My
small RAID partition of 170 GB would fill up so fast that I couldn't wait 1
day, let alone 24 hours.

The next popular response was to use touch along with find something like
this:

touch -acm MMDDhhmm foo
find . -newer foo -exec rm {} \;

This works, but it wasn't the solution I used.

The third most popular response was to use perl and/or C to do the problem.
Problem for me is that I'm not a programmer.  The programs people gave me
worked (or worked with little modification).  Very cool.

The least popular, and the one I ended up using was to use GNU find for
removing the files.  GNU find has the finer granularity of having minutes
and hours for checking files.  So here's the command I'm running to remove
files:

/usr/local/bin/find /export/home/grant -type d -mmin +360 -exec rm -rf {} \;

This ensured that directories and files got removed as well.

Grant

Here's my original message:

Hi gurus.
 
Does anybody know of a way to use find to remove files that are older
than 6 hours?  The man page didn't turn up anything, and I didn't see
anything in dejanews.  The system is an E450 running Solaris 8.  Thanks!

Grant
Received on Mon Oct 15 14:09:03 2001

This archive was generated by hypermail 2.1.8 : Wed Mar 23 2016 - 16:32:33 EDT