1 | initial version |
Certainly not the best way, but here is how I did it using the answer of @eric_g:
In a terminal, show a list of all notebooks:
sage -n export --list
Copy the output into the clipboard and paste into a text editor that allows block selection, e.g. geany in linux. Then create a new directory (e.g. 'fromsagenb') to make sure that you don't overwrite existing files and copy the block just containing the names into a new file in the empty folder, e.g. 'list.txt'.
Now execute the following code to convert all sage notebooks in that list into jupyter notebooks:
import os
os.chdir('/path_to_fromsagenb/')
f = open('list.txt')
str1 = f.read()
str2 = str1.splitlines()
for name in str2:
command = '~/Programs/SageMath/sage -n export --ipynb={0}.ipynb {0}'.format(name)
os.system(command)