07-13-2010, 03:09 PM | #1 |
Junior Member
Posts: 3
Karma: 10
Join Date: Jul 2010
Device: Kindle 2
|
Calibre leaving behind garbage in the filesystem?
Hello
after looking through my Calibre folder I noticed there are some folders which don't have a corresponding author. It seems that after reorganizing my library old files are left behind leading to duplicated files. Can anyone else confirm this? I cleaned my Calibre folder with the following python script Code:
# -*- coding: utf8 -*- import os import shutil import sqlite3 BASE_PATH = r'C:\Users\tobias\Documents\My Dropbox\Public\Calibre Bibliothek' DB = 'metadata.db' CALIBRE2OPDS_FOLDER = '_catalog' con = sqlite3.connect(os.path.join(BASE_PATH, DB)) db_folders = set(n[0].split('/')[0] for n in con.execute('select path from books').fetchall()) con.close() file_folders = set(d for d in os.listdir(BASE_PATH) if os.path.isdir(os.path.join(BASE_PATH, d)) and d != CALIBRE2OPDS_FOLDER) for f in file_folders - db_folders: print("Deleting unused directory {0}".format(f)) shutil.rmtree(os.path.join(BASE_PATH, f)) Regards Tobias |
07-13-2010, 03:17 PM | #2 |
creator of calibre
Posts: 44,337
Karma: 23661992
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
calibre will leave behind folders if they are not empty (i.e. they contain files not managed by calibre).
|
Advert | |
|
07-13-2010, 03:25 PM | #3 |
Junior Member
Posts: 3
Karma: 10
Join Date: Jul 2010
Device: Kindle 2
|
But I can't remember adding files manually. All folders seemed to be from books which had the wrong author after adding the book. After changing the metadata of the book the old folder was left behind with all files. I keep watching it and will file a bug when I can reproduce it. By the way, great app! My donation should arrive soon!
|
07-13-2010, 03:39 PM | #4 |
Wizard
Posts: 4,553
Karma: 950151
Join Date: Nov 2008
Device: Sony PRS-950, iphone/ipad (Marvin/iBooks/QuickReader)
|
I notice that you have CALIBRE2OPDS mentioned in your script. Recent releases of calibre2opds adds a thumbnail file to the calibre book folders so if the only file left behind is a .jpg or a .png file this might be the culprit? If it is the case then mention it here and then we can see if something can be done about that for the future.
|
Tags |
bug |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Calibre puts garbage JPG files on the Nook | HunterZ | Calibre | 25 | 09-12-2010 09:23 AM |
Leaving iRex for Nook | jjansen | iRex | 2 | 08-01-2010 01:26 PM |
any harm from leaving the reader turned on? | ebooker | Sony Reader | 11 | 11-21-2009 04:41 AM |
Leaving Calibre running kills my desktop manager | rogue_ronin | Calibre | 3 | 10-24-2009 08:27 PM |
Any reason to load books using Calibre instead of copying to filesystem? | radius | Calibre | 4 | 08-07-2008 03:05 AM |