Created
December 13, 2009 21:40
-
-
Save pawelz/255618 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This script searches directory for maildirs. | |
# It is designed to work with mutt. Add following line to your muttrc: | |
# mailboxes `/path/to/maildirscan.sh /path/to/top/level/maildir | |
# This program is free software. It comes without any warranty, to | |
# the extent permitted by applicable law. You can redistribute it | |
# and/or modify it under the terms of the Do What The Fuck You Want | |
# To Public License, Version 2, as published by Sam Hocevar. See | |
# http://sam.zoy.org/wtfpl/COPYING for more details. | |
` | |
if [ "$#" != "1" ]; then | |
exit 1 | |
fi | |
scan() { | |
cd $1 | |
local list="$(ls -x)" | |
for I in $list; do | |
if [ -d $I ]; then | |
if [ "$I" != "cur" -a "$I" != "tmp" -a "$I" != "new" ]; then | |
scan $I | |
fi | |
fi | |
done | |
if echo "x $list x" | grep " new " > /dev/null; then | |
echo -n "$PWD " | |
fi | |
cd .. | |
} | |
scan $1 | |
echo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment