script to count items in Maildir folders.
authorChris Koeritz <fred@gruntose.com>
Fri, 30 Mar 2012 16:27:24 +0000 (12:27 -0400)
committerChris Koeritz <fred@gruntose.com>
Fri, 30 Mar 2012 16:27:24 +0000 (12:27 -0400)
scripts/email/count_maildir.sh [new file with mode: 0644]

diff --git a/scripts/email/count_maildir.sh b/scripts/email/count_maildir.sh
new file mode 100644 (file)
index 0000000..d927383
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/bash
+
+# counts up the files in each maildir 'cur' folder to find out how many messages are
+# held in each subdirectory.
+
+pushd "$HOME/Maildir" &>/dev/null
+
+folderlist=$TMP/zz_folder_list.txt
+
+find . -name "cur" >$folderlist
+
+while read line; do echo -n "$line  -- " ; find "$line" -type f | wc -l ; done < $folderlist
+
+popd &>/dev/null
+
+# how to sum the totals...
+# another command perhaps.
+# bash ~/count_maildir.sh | sed -e 's/.* -- \(.*\)$/\1/' | paste -sd+ | bc
+