Numeric arguments for the find command can be specified as

+n for greater than n,
-n for less than n,
 n for exactly n

You probably want to use "-mtime +4" as your test.

Look for the TESTS section of the find manpage.


Juan

On Thu, 5 Dec 2002, Brenden Walker wrote:

> Date: Thu, 5 Dec 2002 16:40:35 -0500
> From: Brenden Walker <[EMAIL PROTECTED]>
> Reply-To: [EMAIL PROTECTED]
> To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> Subject: Find -mtime doesn't seem to work properly.
>
> I'm using RH7.3 (with all the latest).  I have a directory with several
> temporary subdirectories that I'd like to clean up.
>
> find /home/worktmp -type d -mtime 4 | xargs rm -rf
>
> (whole bunches of tmp1, tmp2, tmp3 directories there).
>
> I only want to delete the directories if the last modified time is 4 days
> old in this example.  Well, this doesn't work.  When I was testing last
> night there were directories with modify times from August this year...
>
> I cleaned it up using tmpwatch, but this is going to kill files in the
> directories regardless of the directory last modified time, I only want to
> delete all files and the directory when all files are older than x days.
>
> Anybody have suggestions?  From what I can tell the -mtime should work, but
> it simply does not (or I'm using it totally wrong ;-)



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]?subject=unsubscribe
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to