On Fri, 5 Mar 2010, t.piwowar wrote:

> The following was suggested to me for a cron job to delete old emails
> from a spam folder. I don't completely understand the syntax at the
> end of the line.
>
> find /home/user/mail/domain/email/.spam -type f +mtime 30 -exec rm -f '{}'
\;
>
>
> should not "+mtime 30" be "-mtime +30"

Yes, it should be -mtime
  30 if you want exactly 30 days
  +30 for 30 days and older
  -30 for 30 days and younger


> What does "'{}'" (quote lbrace rbrace quote) mean?

You can skip the single quotes.  {} means substitute what the find
command found in earlier part, into the -exec section.


> What does the "\" at the end mean?

\; is the end of your -exec option.  So, you could have another
option after that (ie: ... -exec rm -f {} \; -print)

However, this is a dangerous command.  Run the following first to
see what it does.  If you like the output, run it with 'rm -f'
instead of 'ls -l'

   find /some/path -type f -mtime +30 -exec ls -l {} \;


*************************************************************************
**  List info, subscription management, list rules, archives, privacy  **
**  policy, calmness, a member map, and more at http://www.cguys.org/  **
*************************************************************************

Reply via email to