summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2019-01-31 09:20:56 +0100
committermakefu <github@syntax-fehler.de>2019-01-31 09:20:56 +0100
commit0290520369ee4c2a15ff84da6600818f840e636c (patch)
treec2764b233f1ece0d014b26f2946ac5914c93f334
parenteffe6d292725b23cf50a81c8bb524bdd46d888f9 (diff)
add the offlineimap remove empty folder article
-rw-r--r--content/posts/offlineimap-remove-empties.rst42
1 files changed, 42 insertions, 0 deletions
diff --git a/content/posts/offlineimap-remove-empties.rst b/content/posts/offlineimap-remove-empties.rst
new file mode 100644
index 0000000..1af16ba
--- /dev/null
+++ b/content/posts/offlineimap-remove-empties.rst
@@ -0,0 +1,42 @@
+Remove empty folders in offlineimap
+###################################
+:date: 2019-01-31 16:00
+:tags: offlineimap
+
+
+Offlineimap becomes quite slow when you have so many (empty folders), this is
+how you can delete them.
+
+The blog post is based on a (now offline) article_ by Matt Palma.
+
+**Disclaimer:**
+
+Besure to double and triple check every command, actions on the remote
+are permanent.
+If you want to read more about the dangers of deleting stuff, read the
+Matt Palmers article_.
+
+Find all empty folders
+----------------------
+.. code-block:: bash
+ for i in INBOX.*; do find $i -type f | grep -q $i || \
+ (echo $i ); done >/tmp/empties
+ cat /tmp/empties
+
+Remove empty folders locally
+--------------------
+.. code-block:: bash
+ for i in $(cat /tmp/empties); do
+ rm -rvf $i
+ done
+
+Remove empty folders via offlineimap remotely
+--------------------
+
+.. code-block:: bash
+ for i in $(cat /tmp/empties); do
+ offlineimap --delete-folder $i
+ done
+
+
+.. _article: https://web.archive.org/web/20160810001943/http://www.hezmatt.org/~mpalmer/blog/2007/06/03/offlineimap-and-deleting-folders.html