[PATCH] folder/Maildir: ignore dot files

Nicolas Sebrecht nicolas.s-dev at laposte.net
Sat Dec 5 11:55:35 GMT 2015


On Sat, Dec 05, 2015 at 03:55:36AM -0500, Christian Hopps wrote:
> 
> Is it possible to configure offlineimap to ignore emacs lock 
> files? When I have a draft open in emacs offlineimap fails with an 
> error such as this:

<...>

> OSError: [Errno 2] No such file or directory: 
> '/[path-removed]/Drafts/cur/.#1449285070.a2f54ffc8b313375.stubbs:2,DS' 
> It would seem this could be avoided if I could configure 
> offlineimap to ignore files matching the re "\.#.*", or by having 
> it ignore dot files in general while syncing.

While at it, I'd rather make OfflineIMAP ignore any dot file.

Please test this patch from:

  https://github.com/nicolas33/offlineimap/tree/ns/ignore-dot-files


-->8--

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev at laposte.net>
---
 offlineimap/folder/Maildir.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/offlineimap/folder/Maildir.py b/offlineimap/folder/Maildir.py
index 19a9ecf..64570a1 100644
--- a/offlineimap/folder/Maildir.py
+++ b/offlineimap/folder/Maildir.py
@@ -163,6 +163,8 @@ class MaildirFolder(BaseFolder):
 
         date_excludees = {}
         for dirannex, filename in files:
+            if filename.startswith('.'):
+                continue # Ignore dot files.
             # We store just dirannex and filename, ie 'cur/123...'
             filepath = os.path.join(dirannex, filename)
             # Check maxsize if this message should be considered.
-- 
2.6.0





More information about the OfflineIMAP-project mailing list