X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=update_lists;h=3a3df8f4512ede8ecebc98973452234490bd3932;hb=9e186b40ce36741d375de72ee5def0d8db21da2d;hp=d398991011de6864759149ede8de7300ab1cc48c;hpb=8c734b37f3a9bad042bdd5dd374e0540dc475dcd;p=bin.git diff --git a/update_lists b/update_lists index d398991..3a3df8f 100755 --- a/update_lists +++ b/update_lists @@ -1,17 +1,17 @@ #!/bin/bash -for listdir in lists bugs; do - ( cd ~/Maildir; - find $listdir -maxdepth 1 -mindepth 1 -type d | \ - perl -ne 'chomp; $a = $_; $b = $a; $b =~ s/\./_/g; $b =~ s/\//./g; qx(ln -sf "$a" ".$b")'; - ); - ( cd ~/Maildir/$listdir; - find . -maxdepth 1 -mindepth 1 -type d| \ - xargs -n 1 -i bash -c 'A={}; (( $(find "$A" -type f -name "*" -not -name "dovecot*" -not -name ".imap*" -not -name ".customflags" | wc -l) == 0 )) && rm -rf "$A"'; +set -e + +for maildir in Maildir Mail; do + if ! [ -e ~/$maildir ]; then + continue + fi; + ( cd ~/$maildir ; + for listtype in lists bugs; do + find . -maxdepth 1 -mindepth 1 -type d -iname "$listtype"'.*' -print0| + xargs -0 -i bash -c 'A={}; (( $(find "$A" -type f -name "*" -not -name "dovecot*" -not -name ".imap*" -not -name ".customflags" | wc -l) == 0 )) && rm -rf "$A"'; + done; + find . -maxdepth 1 -mindepth 1 -type l -iname '.*' -not -xtype d -delete; ); + exit 0; done; - -# Remove broken symlinks -(cd ~/Maildir; - find . -maxdepth 1 -mindepth 1 -type l -iname '.*' -not -xtype d -delete; -);