macos – Delete all data from MacBook except a certain folder?

I can not find a clear step-by-step guide on how to completely delete all the data, applications, cache of my Mac (to give it to another friend), but keep a certain record that I can not save otherwise (that is 40 GB and we are far from home).

I have a MacBook Pro under MacOS Mojave. I have a folder on the desktop and I want to delete all data from the Mac, including all the cache and applications, and leave it there.

We can and must keep the Mojave macOS as I just downloaded it.

I want really remove everything because there is a lot of waste, cache, private keys, etc.