Unfortunately it wasn't so easily solved....
I copied the database file from the other HDD and started importing the folder to bring in the 'new' books.
It got a bit of the way through before giving an error - something about the import robot(?) failing. Clicking details showed me which book it happened on, and since it wasn't a book I cared about much I simply deleted it, and tried again.
The same thing happened once more on a different book.
I closed Calibre down and restarted it, and then when I tried to go into the library it gave a database corrupt error.
Trying to restore it got most of the way through, until it failed towards the end with this message:
calibre, version 2.83.0
ERROR: Failed to repair library: Restoring database failed, click Show details to see details
Traceback (most recent call last):
File "site-packages\calibre\db\restore.py", line 127, in run
File "site-packages\calibre\db\restore.py", line 280, in replace_db
WindowsError: [Error 32] The process cannot access the file because it is being used by another process: u'E:\\eBooks\\metadata.db'
This is the message it shows when I try to open it now:
calibre, version 2.83.0
Corrupted database: The library database at E:\eBooks appears to be corrupted. Do you want calibre to try and rebuild it automatically? The rebuild may not be completely successful.
Traceback (most recent call last):
File "site-packages\calibre\gui2\ui.py", line 648, in library_moved
File "site-packages\calibre\db\legacy.py", line 78, in __init__
File "site-packages\calibre\db\cache.py", line 350, in init
File "site-packages\calibre\db\backend.py", line 1239, in read_tables
File "site-packages\calibre\db\tables.py", line 110, in read
File "c:\cygwin64\home\kovid\sw\build\apsw-3.8.2-r1\src\cursor.c", line 231, in resetcursor
CorruptError: CorruptError: database disk image is malformed
I tried to run the repair function from the command line again, but it gives this error:
E:\eBooks\1 - Calibre Portable\Calibre>calibredb restore_database -r
Qt: Untested Windows version 10.0 detected!
Starting restoring preferences and column metadata ... 0%
Cannot restore preferences. Backup file not found. ... 100%
Restoring database failed with error:
Traceback (most recent call last):
File "site-packages\calibre\db\restore.py", line 127, in run
File "site-packages\calibre\db\restore.py", line 281, in replace_db
File "shutil.py", line 83, in copyfile
IOError: [Errno 2] No such file or directory: u'C:\\Users\\danie\\OneDrive\\Documents\\Calibre Library\\metadata.db'
Possibly as the library isn't in the default directory? (I can move it there if it will help)
I can delete the corrupted database file and restore it with the one from the other HDD again but I can only imagine the same thing will happen again so I'm not sure where to go from here.