Skip to content

Instantly share code, notes, and snippets.

@zanshin
Created March 23, 2018 19:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zanshin/f54ad65e1755eda5d45d597953771864 to your computer and use it in GitHub Desktop.
Save zanshin/f54ad65e1755eda5d45d597953771864 to your computer and use it in GitHub Desktop.
mailboxes
set folder=~/.mail
mailboxes +”foo”
# find sorts things in strange ways. for example: Lists will come after
# Lists/Atomic, here the printf prints the name of the folder we need, and the
# folder's depth. Numeric sort on the depth first, then the name, then do some
# cleanup (escape any spaces in the directory name and then print all the
# mailboxes on 1 line)
mailboxes `find ~/.mail/foo/ -type d -name cur -printf '%h\t%d\n'| sort -n | tr ' ' '\\ ' | awk -F'\t' '{ ORS=" "}{ print $1 }'`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment