07-07-2018, 10:32 AM | #1 |
Zealot
Posts: 118
Karma: 10
Join Date: Dec 2008
Location: France
Device: None
|
Command line instruction to export all data ?
Hi
(Windows 10, calibre 3.27) I've used the option "Export all your data" (not sure of the name in english) from the Library menu to transfer my library and all the settings, extensions, etc., to my laptop. It's a great tool, it worked very well and I now have an exact copy on my laptop. Is there a way to do the export via the CLI ? I'd like to run this option via a batch file + Windows Task Scheduler. (I already do this with "calibredb export" but if I'm not mistaken, it's only to export books, not the whole calibre configuration.) I didn't find anything in the doc. Thanks. |
07-07-2018, 01:10 PM | #2 |
creator of calibre
Posts: 43,851
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
calibre-debug --export-all-calibre-data
|
Advert | |
|
07-08-2018, 01:48 AM | #3 |
Zealot
Posts: 118
Karma: 10
Join Date: Dec 2008
Location: France
Device: None
|
Thanks, but when prompted for a path, I keep getting an error about the syntax.
Code:
> calibre-debug --export-all-calibre-data Enter path to an empty folder (all exported data will be saved inside it): c:\test Code:
Python function terminated unexpectedly [Error 123] La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte: u'c:\\test\r' (Error Code: 1) Traceback (most recent call last): File "site.py", line 101, in main File "site.py", line 78, in run_entry_point File "site-packages\calibre\debug.py", line 325, in main File "site-packages\calibre\utils\exim.py", line 391, in run_exporter File "os.py", line 157, in makedirs WindowsError: [Error 123] La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte: u'c:\\test\r' |
07-08-2018, 02:26 AM | #4 |
creator of calibre
Posts: 43,851
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Strange, I dont see anything that could cause that. You can always create the emty directory yourself first the calibre will not try to create it.
|
07-08-2018, 02:27 AM | #5 |
creator of calibre
Posts: 43,851
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Never mind, I see it is because there is an extra carriage return at the end of the directory name -- probably something weird about the console in your system? Are you running it in cygwin or a normal windows command prompt?
|
Advert | |
|
07-08-2018, 02:57 AM | #6 |
Zealot
Posts: 118
Karma: 10
Join Date: Dec 2008
Location: France
Device: None
|
I'm using ConEmu (https://conemu.github.io/).
But I tried with a normal windows command prompt and the end of the error message is different now. Folder created in File Explorer before running the command : Code:
C:\>calibre-debug --export-all-calibre-data Enter path to an empty folder (all exported data will be saved inside it): c:\test Python function terminated unexpectedly [Error 123] La syntaxe du nom de fichier, de rTraceback (most recent call last): File "site.py", line 101, in main File "site.py", line 78, in run_entry_point File "site-packages\calibre\debug.py", line 325, in main File "site-packages\calibre\utils\exim.py", line 391, in run_exporter File "os.py", line 157, in makedirs WindowsError: [Error 123] La syntaxe du nom de fichier, de rpertoire ou de volume est incorrecte: u'c:\\test\r' close failed in file object destructor: sys.excepthook is missing lost sys.stderr Folder not created before running the command, same result : Code:
C:\>calibre-debug --export-all-calibre-data Enter path to an empty folder (all exported data will be saved inside it): c:\test2 Python function terminated unexpectedly [Error 123] La syntaxe du nom de fichier, de rTraceback (most recent call last): File "site.py", line 101, in main File "site.py", line 78, in run_entry_point File "site-packages\calibre\debug.py", line 325, in main File "site-packages\calibre\utils\exim.py", line 391, in run_exporter File "os.py", line 157, in makedirs WindowsError: [Error 123] La syntaxe du nom de fichier, de rpertoire ou de volume est incorrecte: u'c:\\test2\r' close failed in file object destructor: sys.excepthook is missing lost sys.stderr |
07-08-2018, 03:33 AM | #7 |
creator of calibre
Posts: 43,851
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I have no idea why your console is doing that, but in any case, since \r is not legal in filenames, this should work around it: https://github.com/kovidgoyal/calibr...ba5bea9cb26db4
|
07-08-2018, 07:37 AM | #8 |
Zealot
Posts: 118
Karma: 10
Join Date: Dec 2008
Location: France
Device: None
|
Thanks Kovid.
I'll check again at the next calibre update. (I just tested on my laptop (Windows 10 fresh install) and I have the same error) |
07-10-2018, 09:14 AM | #9 |
Wizard
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
|
@Kovid,
I just recognize the old version had not worked for me too and I had forgot to report that some when in May. I just see the remark in my script I run your new modification from source. It is a bit better as I can now pass a backup directory, but if I select only one of the libraries no library will be backup. Spoiler:
I have a little additional request. Is it possible to add some arguments for scripting? I like to pass a backup directory and in addition only dedicated libraries or "all" as parameters. No parameter means the original behavior as it is now. This would be very helpful. Last edited by Divingduck; 07-10-2018 at 09:19 AM. |
07-10-2018, 11:48 AM | #10 |
creator of calibre
Posts: 43,851
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
There you go: https://github.com/kovidgoyal/calibr...836c2d918bb6a1
|
07-10-2018, 05:10 PM | #11 |
Wizard
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
|
Thank you very much.
I test from command line and select some of the libraries. This worked very well. Same for scripting. The only thing what I was not able to do: all libraries as script. For those who like to test: calibre-debug --export-all-calibre-data [backup_dir] [library1] [library2] ... Needs absolute paths for the export directory and libraries and quotation marks if path or library names include spaces. Sample script: calibre-debug --export-all-calibre-data c:\path\to\backup_dir C:\path\to\first\library\library_name "C:\path with space\to\second\library name" [...] |
07-10-2018, 09:43 PM | #12 |
creator of calibre
Posts: 43,851
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
|
07-11-2018, 04:56 AM | #13 |
Wizard
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
|
Sweet. This works perfect. Just finished a backup about 68GB on my test system.
Question, do you need to modify --import-calibre-data as well? I've trouble to run this via cmd on my test system. There seems to be the same behavior for passing a backup directory. Spoiler:
It would be nice having the scripting similar to the exporter |
07-11-2018, 05:21 AM | #14 |
creator of calibre
Posts: 43,851
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
I will fix the import input, but I dont see the point of making it scriptable. It's not like it needs to be run regularly.
|
07-11-2018, 05:29 AM | #15 |
Wizard
Posts: 1,161
Karma: 1404241
Join Date: Nov 2010
Location: Germany
Device: Sony PRS-650
|
Yes, I understood.
The additional request was more for having a automated test scenario to verify a backup w/o the need for checking this personally. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Is there a way to execute a non-root command without access to command line | Galunid | Kindle Developer's Corner | 4 | 05-15-2018 07:50 PM |
Export Calibre Data | GeckoFriend | Library Management | 4 | 03-27-2018 03:15 PM |
Export Category Editor data | DedTV | Library Management | 6 | 06-03-2013 04:06 AM |
Any command line to edit epub meta data? | bthoven | Calibre | 1 | 03-25-2010 07:26 AM |
Any command line to edit epub meta data? | bthoven | ePub | 2 | 03-25-2010 04:15 AM |