summaryrefslogtreecommitdiff
path: root/sfeed_maildir
blob: 099bc1395e17d5b22e30fbcf0dfacb6dc74c9d6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
# Uses procmail to format mbox to maildir, see procmailrc.example.
# Copy procmailrc.example to $procmailconfig (see below).
# Depends on: procmail, formail, sfeed_mbox.

maildir="$HOME/feeds"
feedsdir="$HOME/.sfeed/feeds"
procmailconfig="$HOME/.sfeed/procmailrc"

# message-id cache to prevent duplicates.
mkdir -p "${maildir}/.cache"

find "${feedsdir}" -type f -exec printf '%s\n' {} \; | while read -r d; do
	(name=$(basename "${d}")
	mkdir -p "${maildir}/${name}/cur"
	mkdir -p "${maildir}/${name}/new"
	mkdir -p "${maildir}/${name}/tmp"
	printf 'Mailbox %s\n' "${name}"
	sfeed_mbox "${d}" | formail -s procmail "${procmailconfig}") &
done
wait