summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rwxr-xr-xmark-maildir-seen27
2 files changed, 28 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 129fbdc..6a56982 100644
--- a/Makefile
+++ b/Makefile
@@ -17,6 +17,7 @@ scripts = \
jwt-decode \
keepalive \
lorem \
+ make-maildir-seen \
mbox2maildir \
minimify \
musictomp3 \
diff --git a/mark-maildir-seen b/mark-maildir-seen
new file mode 100755
index 0000000..a742a0b
--- /dev/null
+++ b/mark-maildir-seen
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+set -eu
+
+rename() {
+ local dirname="$1"
+ local pattern="$2"
+ local suffix="$3"
+
+ find "$dirname"/cur "$dirname"/new -type f \
+ -name "*:2,*" \
+ ! -name "$pattern" \
+ -exec mv '{}' '{}S' ';'
+}
+
+mark_seen()
+{
+ local dirname="$1"
+ rename "$dirname" "*:2,*S*" "S"
+}
+
+
+for dirname in "$@"
+do
+ mark_seen "$dirname"
+done
+