aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xgetmails-alternative24
1 files changed, 21 insertions, 3 deletions
diff --git a/getmails-alternative b/getmails-alternative
index cf36e5e..8fd7ef2 100755
--- a/getmails-alternative
+++ b/getmails-alternative
@@ -10,7 +10,9 @@
#
# Parameters
-CONFIG_FOLDER="${1:-$HOME/.config/getmail}"
+BASE_FOLDER="$HOME/.config/getmail"
+CONFIG_FOLDER="${1:-$BASE_FOLDER}"
+METADATA_FOLDER="$BASE_FOLDER/.metadata"
GETMAIL="/usr/bin/getmail"
# Check
@@ -18,5 +20,21 @@ if [ ! -d "$CONFIG_FOLDER" ]; then
exit
fi
-# Dispatch
-ls -1 $CONFIG_FOLDER | grep -v '^oldmail-' | grep '@' | grep -v '.disabled$' | xargs echo | sed -e 's/ / --rcfile /g' | xargs $GETMAIL -g$CONFIG_FOLDER --rcfile
+# Metadata is stored in a separate folder
+mkdir -p $METADATA_FOLDER
+
+# Dispatch, block version
+#find $CONFIG_FOLDER -type f | grep -v 'oldmail-' | grep '@' | grep -v '.disabled$' | while read config; do
+# # Metadata is stored on each folder
+# folder="`dirname $config`"
+# $GETMAIL -g$folder --rcfile $config
+#done
+
+# Dispatch, old oneliner version
+#ls -1 $CONFIG_FOLDER | grep -v '^oldmail-' | grep '@' | grep -v '.disabled$' | xargs echo | sed -e 's/ / --rcfile /g' | xargs $GETMAIL -g$CONFIG_FOLDER --rcfile
+
+# Dispatch, new oneliner version, recursive and with data stored in the main folder
+#find $CONFIG_FOLDER -type f | grep -v 'oldmail-' | grep '@' | grep -v '.disabled$' | xargs echo | sed -e 's/ / --rcfile /g' | xargs $GETMAIL -g$CONFIG_FOLDER --rcfile
+
+# Dispatch, new oneliner version, recursive and with data stored in the metadata folder
+find $CONFIG_FOLDER -type f | grep -v 'oldmail-' | grep '@' | grep -v '.disabled$' | xargs echo | sed -e 's/ / --rcfile /g' | xargs $GETMAIL -g$METADATA_FOLDER --rcfile