From 295a64252235468d1a6f74251cdf0e204aba4e1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jarno=20Sepp=C3=A4nen?= Date: Sun, 18 May 2014 12:40:07 +0300 Subject: [PATCH] Clean up empty encrypted directories --- gpgstore.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gpgstore.py b/gpgstore.py index fa98d3e..d123409 100644 --- a/gpgstore.py +++ b/gpgstore.py @@ -60,6 +60,11 @@ class GpgStore(object): def delete(self, path): os.remove(self.encroot + '/' + path) + if len(path) >= 3 and path[2] == '/': + try: + os.rmdir(self.encroot + '/' + path[:2]) + except OSError: + pass log.debug('deleted %s' % path) def exists(self, path):