From c4719886fc4a24d60fd7f1966926f7dd09ef551c Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Wed, 30 Jan 2008 02:56:28 +0000 Subject: [PATCH] update lists --- update_lists | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 update_lists diff --git a/update_lists b/update_lists new file mode 100755 index 0000000..d23aa24 --- /dev/null +++ b/update_lists @@ -0,0 +1,16 @@ +#!/bin/sh + +cd ~/Maildir +# Build lists sublists +find lists -maxdepth 1 -mindepth 1 -type d |perl -ne 'chomp; $a = $_; $b = $a; $b =~ s/\//./g; qx(ln -sf $a .$b)' +# Build bugs sublists +find bugs -maxdepth 1 -mindepth 1 -type d |perl -ne 'chomp; $a = $_; $b = $a; $b =~ s/\//./g; qx(ln -sf $a .$b)' + +# Remove dead lists +#find ~/Maildir/lists/ -type d -maxdepth 1 -mindepth 1|xargs -n 1 -i sh -c '(( $(find "{}" -type f -iname "*" |wc -l) <= 1 )) && rm -rf "{}"' + +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' +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' + +# Remove broken symlinks +find . -maxdepth 1 -mindepth 1 -type l -iname '.*' -not -xtype d -print0 |xargs -0 rm -f \ No newline at end of file -- 2.39.2