Recursive delete directories in file browser?

Is there a way to enable recursive deletion of a directory in the file browser? Currently, if a user clicks delete on a non-empty folder, they get an error that the folder is not empty.

Yes, I know this matches the behavior of command-line shell tools like rm or rmdir, but I have yet to see another GUI interface that presents users with this same design. Is it possible to change this behavior? I’d very much love to be able to teach my students from JupyterLab as a first-class environment without suggesting they fall back on code-server, rstudio, or command-line.

I recall that this behaviour varies between file systems (and thus is different by default on Windows as compared to Linux). I think setting FileContentsManager.always_delete_dir to true in jupyter-server configuration might help you, but there are caveats. See Config file and command line options — Jupyter Server documentation

thanks so much, this worked perfectly.

For reference, for my k8s setup I had to put this in singleuser section of values.yaml

singleuser:
   extraFiles:
     jupyter_server_config.json:
         mountPath: /usr/local/etc/jupyter/jupyter_server_config.json
         data:
            ContentsManager:
              allow_hidden: true
            FileContentsManager:
              always_delete_dir: true
1 Like