procmail
[Top] [All Lists]

Re: error report from recipe

2007-08-24 05:31:57
* Gerald V. Livingston II <debuser(_at_)sysmatrix(_dot_)net> [08-24-07 05:26]:
On Fri, 24 Aug 2007 10:29:06 +0200 Dallman Ross <dman(_at_)nomotek(_dot_)com> 
wrote:

On Thu, Aug 23, 2007 at 10:25:12PM -0600, LuKreme wrote:

On 23-Aug-2007, at 15:53, Dallman Ross wrote:

Or if that's no good, you could use find.

   rm -f dummy `find ~/mail/backup -maxdepth 1 -type f -name  
'msg.*' -mtime +7`


   find ~/mail/backup -maxdepth 1 -type f -name 'msg.*' -mtime +7 - 
delete

(for any reasonably modern find)

Eh?

   10:26am [/var/tmp/.dman] 552[0]> find . -mtime +30 -delete
  find: -delete: unknown option
  
   10:26am [/var/tmp/.dman] 553[1]> gfind . -mtime +30 -delete
  gfind: invalid predicate `-delete'
[...]
dman

From 'man find' on my system:

ACTIONS
       -delete
              Delete files; true if removal succeeded.  If the removal 
failed, 
              an error message is issued.  Use of this action automatically 
              turns on the ?-depth? option.

and:  `find ~/mail/backup -maxdepth 1 -type f -name 'msg.*' |\
            -mtime [# of days] -delete`

works correctly on my openSUSE 10.1 system.

~> find --version
GNU find version 4.2.27
Features enabled: D_TYPE O_NOFOLLOW(enabled) LEAF_OPTIMISATION 


I believe that the find w/delete is more efficient that piping to sed,
so the final recipe:

# -------------------------------------------------------
:0 c 
$MAILDIR/backup

:0 ic
| cd ~/mail/backup && |\
  `find ~/mail/backup -maxdepth 1 -type f -name 'msg.*' |\ 
  mtime +28 -delete`
# -------------------------------------------------------


point:  doesn't "find ~/mail/backup" make the "cd ~/mail/backup"
        superfluous?
        

tks for the discussion.

-- 
Patrick Shanahan         Plainfield, Indiana, USA        HOG # US1244711
http://wahoo.no-ip.org     Photo Album:  http://wahoo.no-ip.org/gallery2
Registered Linux User #207535                    @ http://counter.li.org
____________________________________________________________
procmail mailing list   Procmail homepage: http://www.procmail.org/
procmail(_at_)lists(_dot_)RWTH-Aachen(_dot_)DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/procmail

<Prev in Thread] Current Thread [Next in Thread>