Re: delete folder before writing to it

Robert Bonomi <[email protected]>
Newsgroups gmane.mail.procmail
Message-ID <[email protected]>
> Date: Fri, 09 Nov 2012 16:09:28 +0100
> From: Eric Smith <[email protected]>
> Subject: Re: delete folder before writing to it
>
> Robert Bonomi wrote on Fri-09-Nov 12  9:32AM
> > > :0c:
> > > {
> > > :0c:
> > > backup
> > > :0f
> > > | rm $MAILDIR/last
> > > :0:
> > > last
> > > }
> > >
> > 
> > try ':0fw' instead of ':0f'.  Must 'wait' for the pipe to complete, before
> > starting the next recipe.
>
> Thanks Robert, alas, it is still not playing nice. Nothing I 
> try leaves any (non-white) data in the folder last.
>
> Any ideas how to have the last and only the last email 
> always living in that folder.
>
> Eric
> ____________________________________________________________
>
>
> Robert Bonomi wrote on Fri-09-Nov 12  9:32AM
> > > :0c:
> > > {
> > > :0c:
> > > backup
> > > :0f
> > > | rm $MAILDIR/last
> > > :0:
> > > last
> > > }
> > >
> > 
> > try ':0fw' instead of ':0f'.  Must 'wait' for the pipe to complete, before
> > starting the next recipe.
>
> Thanks Robert, alas, it is still not playing nice. Nothing I 
> try leaves any (non-white) data in the folder last.

D'oh!  of course not!

The 'c' flag on the 'rm' recipe, causes it to be executed _in_parallel_
with following recipes.

try: 
 :0c:
 {
   foo=`rm $MAILDIR/last`
   :0c:
   backup
   :0:
   last
 }

> Any ideas how to have the last and only the last email 
> always living in that folder.

There's always:
  :0c : last
  | tee -a $MAILDIR/backup > $MAILDIR/last

to replace the entire gubbage you were using.

It's clearer, =and= somewhat faster, than your way.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.