aboutsummaryrefslogtreecommitdiff
path: root/bin/get-mailboxes.sh
blob: e1ff8efb734bbdbd3e8af6a63bd33572c9eb103b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash

maildir=$1

# Find these specific paths so they stick at the top of the list
MAILBOXES='"+Inbox" "+Sent" "+Trash" "+Drafts" "+Junk" '

#Find all other paths, excluding those from above
MAILBOXES=$MAILBOXES`find "$maildir" -type d -name cur \
    -a -not \( -ipath "*Inbox*"                          \
            -o -ipath "*Sent*"                           \
            -o -ipath "*Drafts*"                         \
            -o -ipath "*Trash*"                          \
            -o -ipath "*Junk*"                           \
            \) | sed -e 's/${maildir}//g' -e 's/\/cur$/\"/g' -e "s#^${maildir}/# \"+#" | sort` 

echo $MAILBOXES