]> git.donarmstrong.com Git - bin.git/blob - update_lists
update lists
[bin.git] / update_lists
1 #!/bin/sh
2
3 cd ~/Maildir
4 # Build lists sublists
5 find lists -maxdepth 1 -mindepth 1 -type d |perl -ne 'chomp; $a = $_; $b = $a; $b =~ s/\//./g; qx(ln -sf $a .$b)'
6 # Build bugs sublists
7 find bugs  -maxdepth 1 -mindepth 1 -type d |perl -ne 'chomp; $a = $_; $b = $a; $b =~ s/\//./g; qx(ln -sf $a .$b)'
8
9 # Remove dead lists
10 #find ~/Maildir/lists/ -type d -maxdepth 1 -mindepth 1|xargs -n 1 -i sh -c '(( $(find "{}" -type f -iname "*" |wc -l) <= 1 )) && rm -rf "{}"'
11
12 find ~/Maildir/lists/ -maxdepth 1 -mindepth 1 -type d|xargs -n 1 -i sh -c 'A={}; (( $(find $A -type f -name "*" -not -name "dovecot*" | wc -l) == 0 )) && rm -rf $A'
13 find ~/Maildir/bugs/ -maxdepth 1 -mindepth 1 -type d|xargs -n 1 -i sh -c 'A={}; (( $(find $A -type f -name "*" -not -name "dovecot*" |wc -l) == 0 )) && rm -rf $A'
14
15 # Remove broken symlinks
16 find . -maxdepth 1 -mindepth 1 -type l -iname '.*' -not -xtype d -print0 |xargs -0 rm -f