This also removes all multi-threaded calls to the database as they were not working as expected.
The transactions are now used to keep the database in a sane state, but as far as possible log all messages from the connection to the database without using cross-thread requests.
Also fixed some errors with cleanup and rewrote some of the remote filename parsing and validation.
Implemented delete-all-but-n and delete-older-than.
Implemented compacting.
Added the --dry-run option, which currently works for deleting and compacting, but not restore or backup.
Added output to console for use with dry-run, and added option to redirect this to the log for use in service mode.