best way to convert many notebooks from sagenb to jupyter?

I moved from sagenb to jupyter a while ago, but I still have a large number of sagenb notebooks that I have been converting one-by-one on demand. Is there a way to convert all of them at once and save them to a dedicated folder? Currently, when I start sage -notebook, I get to an interface where I can see all my sagenb notebooks and I have the option to click on any of them, convert and open in jupyter. I would actually like to convert all of them without opening them.
This is related to https://ask.sagemath.org/question/358..., but I suppose that there is a better way now. Thanks already for your help!

3 answers

Just to elaborate on @slelievre's answer: you don't have to install the SageNB exporter: it is already incorporated in recent versions of Sage; you can run it via the command sage -n export. More precisely, to list all your sagenb notebooks, run

sage -n export --list

Then to transform the notebook listed as admin:12 (say), run

sage -n export --ipynb=output.ipynb admin:12

Instead of admin:12, you can also use directly the notebook name (without any extension, i.e. as it appears in the output of sage -n export --list):

sage -n export --ipynb=notebook_name.ipynb notebook_name

I guess you can easily put this into a loop to treat all your sagenb notebooks at once.

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: