'MacOS how to hide the folders and files located on the desktop

I have folders and files on the desktop, I would like to make sure that when I take a screenshot or video recording of a program, the folders and files I have on the desktop are not seen.

Is there any command on the terminal that allows me to do this?

I need to hide everything only when I do the screen or the recording, and then return everything as before.

How can I do?



Solution 1:[1]

defaults write com.apple.finder CreateDesktop false && killall Finder

will hide all Files and Mounts, with

defaults write com.apple.finder CreateDesktop true && killall Finder

you can display them.

You have to invoke the commands from terminal Tested wit Monterey 12.3

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Paul