Create a global default folder for incoming shares in Nextcloud

When using Nextcloud to share files and folders back and forth the root directory tends to get messy pretty quickly.
In this post I will explain how you can create a folder in the root directory where all incoming shares are placed. This folder for incoming shares will apply for all users of the cloud.
This change will apply for all new incoming shares, but will not move any already shared files or folders. (These can be moved by each user individually)

Edit config.php

The change is done by changing a configuration file in Nextcloud, this is not an option in the GUI itself.
This path should be config/www/nextcloud/config/config.php.
Open this file in a text editor, the most available might be nano, just type nano config/www/nextcloud/config/config.php (change path accordingly).
At the end before ); make a new line and insert the following:

   'share_folder' => '/Folder name',

The code above will make a the share folder named “Folder name“. You can name this what you want, I will call it “Delt med meg” (Norwegian for “Shared with me”). Another possibility is to create a folder with a subfolder. (If that is useful for someone). that can be done like this:

   'share_folder' => '/Folder name/Sub folder name',
config.php modified in GNU nano

Save and Exit, the change should apply immediately.

How it works

When a new file or folder is shared with you (user), a folder named whatever you selected will appear in the user’s root directory. This folder will not appear until something is shared.

Located inside the folder is all newly shared elements.

The folder will as explained before starts to exist for each user when anything new is shared with them, but it will continue to exist even if things are unshared, leaving the folder empty.