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))
I haven't opened a bug till now. Still wondering if I'm doing something wrong.
Regards
Tobias