On 29Oct2020 03:05, Globe Trotter via Mutt-users <mutt-users@mutt.org> wrote:
>My apologies for answering my own question, but I have found the bug: there is 
>an extraneous \" and it should be the following:
>
>mailboxes `find ~/Maildir/* -type d | grep -v "tmp\|new\|cur" | sed 
>'s|~/Maildir/|=\"|g' | sed 's|$||g' | tr '\n' ' '`
>
>It works now, and the problems have also been resolved.
>Thanks again!

I'm glad to hear this.

Might I suggest you put this shell command in a distinct shell script so 
that your muttrc has this:


    mailboxes `mutt-mailboxes`

which avoids a suite of nested-quotes related issues, and also makes it 
easier to modify if you find a need.

You can also improve the find:

    find "$HOME/Maildir"/* -type d \( \( -name tmp -o -name new -o -name cur \) 
-prune \) -o -exec ismaildir {} ';' -print

This find:
- does not print or descend into the tmp/new/cur subdirectories
- only prints actual Maildirs

Regarding the latter, here's some output:

    /Users/cameron/mail/VZ
    /Users/cameron/mail/XREF-REVIEW/xfs

without the "ismaildir" check there would be a spurious:

    /Users/cameron/mail/XREF-REVIEW

directory listed, which is not a Maildir but does contain Maildirs.

Also, being a shell script makes it easier to clean up the paths too:

    #!/bin/sh
    cd "$HOME/Maildir"
    find * -type d \( \( -name tmp -o -name new -o -name cur \) -prune \) -o 
-exec ismaildir {} ';' -print

No stripping, just cd to the top directory and print relative paths.

"ismaildir" is a script of my own:

    https://hg.sr.ht/~cameron-simpson/css/browse/bin/ismaildir?rev=tip

but it is very simple - it just checks for directoriness and the 
presence if the 3 required subdirectories.

Cheers,
Cameron Simpson <c...@cskk.id.au>

Reply via email to