From 3577cd6b8a6a5009711cd773c07c88a3532bfb9d Mon Sep 17 00:00:00 2001 From: John Schember Date: Sat, 27 Jun 2009 21:14:58 -0400 Subject: [PATCH] PRS-505/700 driver: Clean up empty dirs when removing books from device. --- src/calibre/devices/prs505/driver.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/devices/prs505/driver.py b/src/calibre/devices/prs505/driver.py index fe1f987dc9..6b1f33818a 100644 --- a/src/calibre/devices/prs505/driver.py +++ b/src/calibre/devices/prs505/driver.py @@ -207,6 +207,10 @@ class PRS505(CLI, Device): self.report_progress((i+1) / float(len(paths)), _('Removing books from device...')) if os.path.exists(path): os.unlink(path) + try: + os.removedirs(os.path.dirname(path)) + except: + pass self.report_progress(1.0, _('Removing books from device...')) @classmethod