aboutsummaryrefslogtreecommitdiff
path: root/bin/get-mailboxes.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/get-mailboxes.sh')
-rwxr-xr-xbin/get-mailboxes.sh17
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/get-mailboxes.sh b/bin/get-mailboxes.sh
new file mode 100755
index 0000000..e1ff8ef
--- /dev/null
+++ b/bin/get-mailboxes.sh
@@ -0,0 +1,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