Re: Help with the find command

From: Mohamed Kamal (mohamed.kamal@SPDC.COM.EG)
Date: Mon Nov 17 2003 - 17:33:51 EST


Dear Stephen,

  you have to use the negation with the expression ( -type d ). So the command will be like that
find /stephen ! -type d -prune -o -mtime +10 -exec rm -ef {}\;

Best Regards
Mohammed Kamal
Systems Engineer

-----Original Message-----
From: Stephen Spalding [mailto:ssaixadm@YAHOO.COM]
Sent: Mon, November 17, 2003 10:38 PM
To: aix-l@Princeton.EDU
Subject: Help with the find command

All,

I'm writing a script to clean up files under a certain
directory that are over a certain amount of time old.
I'm using the find command to do this. However, I do
not want the find command to traverse any
subdirectories underneath the directory that I've
specified. I don't want to have to name each and every
subdirectory under the directory that's being cleaned
up.

Here's an example of what I'm doing. The directory
name is /stephen. This directory has a bunch of files
under it and two subdirectories: /stephen/files and
/stephen/tmp. I want the find command to completely
ignore /stephen/files and /stephen/tmp and any files
under them, but I want to clean up any files directly
under /stephen that are over 10 days old. Here's the
command that I've been working with:

find /stephen -type d -prune -o -mtime +10 -exec rm
-ef {}\;

Can anyone tell me what I'm doing wrong?

Thanks!

-Stephen Spalding

__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

**********************************************************************
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 archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:17:21 EDT