]> gitweb.fluxo.info Git - utils-mail.git/commitdiff
Feat: getmails-alternative: recursive, with data stored in the metadata folder, plus... master
authorSilvio Rhatto <rhatto@riseup.net>
Wed, 10 Dec 2025 11:19:58 +0000 (08:19 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Wed, 10 Dec 2025 11:19:58 +0000 (08:19 -0300)
getmails-alternative

index cf36e5e136cd8ac7a053b1e95c5e1bb6e3cca832..8fd7ef2c24a35280464954da39b14224fe5023f1 100755 (executable)
@@ -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