Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread David Haguenauer
Hi,

* rog...@sdf.org rog...@sdf.org, 2010-07-14 21:01:01 Wed:
 How can I exclude one folder from my mailbox list using a find
 pipe?
 
 muttrc:
 mailboxes `find ~/.maildir/ -type d -name cur -printf '%h '`
 
 [...] To clarify, I only want to omit my
 /home/roger/.maildir/.roger folder and not my other folders such
 as /home/roger/.maildir/.rog...@isp.net folder(s).

I'd use grep; something like the following:

find ~/.maildir/ -type d -name cur -printf '%h ' | grep -v '\.roger/'

(Adapt the regexp depending on how strict you need to be.)

-- 
David Haguenauer


pgpX0rewUqfn6.pgp
Description: PGP signature


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread Gregor Zattler
Hi rogerx, mutt-users,
* rog...@sdf.org rog...@sdf.org [14. Jul. 2010]:
 How can I exclude one folder from my mailbox list using a find
 pipe?
 
 muttrc:
 mailboxes `find ~/.maildir/ -type d -name cur -printf '%h '`
 
[...]
 To clarify, I only want to omit my /home/roger/.maildir/.roger folder
 and not my other folders such as /home/roger/.maildir/.rog...@isp.net
 folder(s).

How about 
mailboxes `find ~/.maildir/ -type d -name cur -printf '%h\n'|grep -v 
'/home/roger/.maildir/.roger$'|tr \n  `



Ciao, Gregor
-- 
 -... --- .-. . -.. ..--.. ...-.-


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread Roger
On Thu, Jul 15, 2010 at 08:06:17AM +0200, David Haguenauer wrote:
Hi,

* rog...@sdf.org rog...@sdf.org, 2010-07-14 21:01:01 Wed:
 How can I exclude one folder from my mailbox list using a find
 pipe?
 
 muttrc:
 mailboxes `find ~/.maildir/ -type d -name cur -printf '%h '`
 
 [...] To clarify, I only want to omit my
 /home/roger/.maildir/.roger folder and not my other folders such
 as /home/roger/.maildir/.rog...@isp.net folder(s).

I'd use grep; something like the following:

find ~/.maildir/ -type d -name cur -printf '%h ' | grep -v '\.roger/'

(Adapt the regexp depending on how strict you need to be.)


Great THANKS!  I think this one worked right out of the box, as is.

I spent hours looking at man find, google, etc and none worked and I thought
grep -v wouldn't work.


The other email response using ['/home/roger/.maildir/.roger$'|tr \n  ],
I don't know about -- as to why the newline char?


I think I'll post the grep -v option to the Mutt Wiki ConfigTricks!

-- 
Roger
http://rogerx.freeshell.org/


pgpeTH7PqK5i6.pgp
Description: PGP signature


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread rogerx
On Thu, Jul 15, 2010 at 08:07:19AM +0200, Gregor Zattler wrote:
Hi rogerx, mutt-users,
* rog...@sdf.org rog...@sdf.org [14. Jul. 2010]:
 How can I exclude one folder from my mailbox list using a find
 pipe?
 
 muttrc:
 mailboxes `find ~/.maildir/ -type d -name cur -printf '%h '`
 
[...]
 To clarify, I only want to omit my /home/roger/.maildir/.roger folder
 and not my other folders such as /home/roger/.maildir/.rog...@isp.net
 folder(s).

How about 
mailboxes `find ~/.maildir/ -type d -name cur -printf '%h\n'|grep -v 
'/home/roger/.maildir/.roger$'|tr \n  `

On second try, this one actually does work!

-- 
Roger
http://rogerx.freeshell.org/


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread Christian Ebert
* Roger on Wednesday, July 14, 2010 at 23:12:02 -0800
 On Thu, Jul 15, 2010 at 08:06:17AM +0200, David Haguenauer wrote:
 I'd use grep; something like the following:
 
   find ~/.maildir/ -type d -name cur -printf '%h ' | grep -v '\.roger/'
 
 (Adapt the regexp depending on how strict you need to be.)
 
 Great THANKS!  I think this one worked right out of the box, as is.
 
 I spent hours looking at man find, google, etc and none worked and I thought
 grep -v wouldn't work.

You can circumvent grep by find -E ! -regex, note it takes the
full path, or exclude by negating -name: ! -name. Also -printf is
not portable.

I use something like:


mailboxes `find -E ~/Mail -type d \( -name cur -o -name new -o -name tmp \
   ! -regex '.*/(_|(Archive|News)/).*' \
   -execdir pwd \; \) -prune | tr '\n' ' '`


c
-- 
theatre - books - texts - movies
Black Trash Productions at home: http://www.blacktrash.org/
Black Trash Productions on Facebook:
http://www.facebook.com/blacktrashproductions


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread Ed Blackman

On Wed, Jul 14, 2010 at 09:01:01PM -0800, rog...@sdf.org wrote:

@#...@# find.

... anyways.

How can I exclude one folder from my mailbox list using a find
pipe?

muttrc:
mailboxes `find ~/.maildir/ -type d -name cur -printf '%h '`


find ~/.maildir/ -type d -name cur \( -regex '.*/\.roger' -prune -o -printf '%h 
' \)

Ed


signature.txt
Description: Digital signature


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread Cameron Simpson
I'm sorry I'm late to this discussion - you guys seem to have a grep
obsession :-)

On 14Jul2010 23:12, Roger rog...@sdf.org wrote:
| On Thu, Jul 15, 2010 at 08:06:17AM +0200, David Haguenauer wrote:
| * rog...@sdf.org rog...@sdf.org, 2010-07-14 21:01:01 Wed:
|  How can I exclude one folder from my mailbox list using a find
|  pipe?
|  
|  muttrc:
|  mailboxes `find ~/.maildir/ -type d -name cur -printf '%h '`
[...]
| 
| I'd use grep; something like the following:
| 
| find ~/.maildir/ -type d -name cur -printf '%h ' | grep -v '\.roger/'
| 
| (Adapt the regexp depending on how strict you need to be.)
| 
| Great THANKS!  I think this one worked right out of the box, as is.
| 
| I spent hours looking at man find, google, etc and none worked and I thought
| grep -v wouldn't work.
[...]
| I think I'll post the grep -v option to the Mutt Wiki ConfigTricks!

Maybe not.

Isn't this more direct?

  find ~/.maildir/ -type d \( -path ~/.maildir/.roger -prune -o -name cur 
-printf '%h ' \)

It also avoids regexps, which are often annoying (escaping . to \. etc).

You can also speed it up greatly by pruning the search when you hit the
cur or new folders, otherwise find will walk all the messages as
well looking for deeper trees:

  find ~/.maildir/ -type d \( -path ~/.maildir/.roger -prune -o -name cur 
-printf '%h ' -prune -o -name new -prune \)

which can be written:

  find ~/.maildir/ -type d \( -path ~/.maildir/.roger -o -name cur -printf '%h 
' -o -name new \) -prune

And are your maildirs all at the top level, or are they deeper?
If you have a nested tree structure (I do - my old archived email is in
subtrees) you need find.
But if it is just a flat directory (.maildir/a, .maildir/b) you don't
need find at all! Just use echo!

  echo ~/.maildir/*

or 

  for name in ~/.maildir/*; do case $name in */.roger) ;; *) echo $name ;; 
esac; done

Which should be faster than find (no directory tree walking at all).

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

Every particle continues in its state of rest or uniform motion in a straight
line except insofar as it doesn't.  - Sir Arther Eddington


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread Roger
On Thu, Jul 15, 2010 at 11:37:33AM -0400, Ed Blackman wrote:
On Wed, Jul 14, 2010 at 09:01:01PM -0800, rog...@sdf.org wrote:
@#...@# find.

... anyways.

How can I exclude one folder from my mailbox list using a find
pipe?

muttrc:
mailboxes `find ~/.maildir/ -type d -name cur -printf '%h '`

find ~/.maildir/ -type d -name cur \( -regex '.*/\.roger' -prune -o -printf 
'%h ' \)

Nope, /home/roger/.maildir/.roger still gets by this incantation as well!

Yea, tried the \( \) and !, not the regex until now, but they all allow
/home/roger/.maildir/.roger to get by except for the one post here en
stating the newline char at the end of it's incantation.

I always though find to be finicky at times. :-/

(As they say, Do one thing well... and let something else handle the other 
issues.)

-- 
Roger
http://rogerx.freeshell.org/


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread Roger
On Fri, Jul 16, 2010 at 08:05:15AM +1000, Cameron Simpson wrote:
I'm sorry I'm late to this discussion - you guys seem to have a grep
obsession :-)

On 14Jul2010 23:12, Roger rog...@sdf.org wrote:
| On Thu, Jul 15, 2010 at 08:06:17AM +0200, David Haguenauer wrote:
| * rog...@sdf.org rog...@sdf.org, 2010-07-14 21:01:01 Wed:
|  How can I exclude one folder from my mailbox list using a find
|  pipe?
|  
|  muttrc:
|  mailboxes `find ~/.maildir/ -type d -name cur -printf '%h '`
[...]
| 
| I'd use grep; something like the following:
| 
| find ~/.maildir/ -type d -name cur -printf '%h ' | grep -v '\.roger/'
| 
| (Adapt the regexp depending on how strict you need to be.)
| 
| Great THANKS!  I think this one worked right out of the box, as is.
| 
| I spent hours looking at man find, google, etc and none worked and I thought
| grep -v wouldn't work.
[...]
| I think I'll post the grep -v option to the Mutt Wiki ConfigTricks!

Maybe not.

Isn't this more direct?

  find ~/.maildir/ -type d \( -path ~/.maildir/.roger -prune -o -name cur 
 -printf '%h ' \)

Yup.  This incantation works as well!

It also avoids regexps, which are often annoying (escaping . to \. etc).

You can also speed it up greatly by pruning the search when you hit the
cur or new folders, otherwise find will walk all the messages as
well looking for deeper trees:

  find ~/.maildir/ -type d \( -path ~/.maildir/.roger -prune -o -name cur 
 -printf '%h ' -prune -o -name new -prune \)

which can be written:

  find ~/.maildir/ -type d \( -path ~/.maildir/.roger -o -name cur -printf '%h 
 ' -o -name new \) -prune

And are your maildirs all at the top level, or are they deeper?
If you have a nested tree structure (I do - my old archived email is in
subtrees) you need find.
But if it is just a flat directory (.maildir/a, .maildir/b) you don't
need find at all! Just use echo!

  echo ~/.maildir/*

or 

  for name in ~/.maildir/*; do case $name in */.roger) ;; *) echo $name ;; 
 esac; done

Which should be faster than find (no directory tree walking at all).

Cheers,

Every particle continues in its state of rest or uniform motion in a straight
line except insofar as it doesn't.  - Sir Arther Eddington

The rest is interesting, yup, no subfolders here.

It's interesting how the obvious solutions stare us blankly in the face.  I
have been using echo (per wiki), but completely overlooked a for/next
incantation, grappling with find.

Cheers!

-- 
Roger
http://rogerx.freeshell.org/


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread David Haguenauer
* rog...@sdf.org rog...@sdf.org, 2010-07-14 23:26:53 Wed:
 On Thu, Jul 15, 2010 at 08:06:17AM +0200, David Haguenauer wrote:
 I'd use grep; something like the following:
 
 find ~/.maildir/ -type d -name cur -printf '%h ' | grep -v '\.roger/'
 I just tried both of these, and they don't filter using the grep -v.
 
 If I'm not mistaken, find within the above incantation, finds every
 dir with a subfolder named cur, as such, the grep -v filter is
 simply ignored ...  because find already passed every folder on one
 line instead of multiple lines with a newline at the end of each
 folder.

Absolutely. I guess that shows how hard I tested my code before
posting it ;o). I'm sure you have found a command that actually solves
your problem by now.

-- 
David Haguenauer


pgpAPdMuZC9bo.pgp
Description: PGP signature


Re: Using Find, Exclude one mailboxes folder

2010-07-15 Thread Cameron Simpson
On 15Jul2010 15:03, Roger rog...@sdf.org wrote:
| On Fri, Jul 16, 2010 at 08:05:15AM +1000, Cameron Simpson wrote:
|   for name in ~/.maildir/*; do case $name in */.roger) ;; *) echo $name 
;; esac; done
| 
| Which should be faster than find (no directory tree walking at all).
| 
| Cheers,
| 
| Every particle continues in its state of rest or uniform motion in a straight
| line except insofar as it doesn't.  - Sir Arther Eddington
| 
| The rest is interesting, yup, no subfolders here.
| 
| It's interesting how the obvious solutions stare us blankly in the face.  I
| have been using echo (per wiki), but completely overlooked a for/next
| incantation, grappling with find.

It's worth noting that the above for loop needs to use:

  ~/.maildir/.*

because plain * won't match .roger, since it starts with a dot.

Cheers,
-- 
Cameron Simpson c...@zip.com.au DoD#743
http://www.cskk.ezoshosting.com/cs/

A Guru is not one who simply knows all the answers.  Rather, a Guru is like
one who walks among the mountains, and by wandering around abit, can see the
horizon through long narrow canyons.