[Solved] Occ file:scan not working for __groupfolder

Nextcloud version: 19.0.3
Operating system and version: Ubuntu 16.04.7
Apache or nginx version: Apache 2.4.46
PHP version: 7.4.10

The issue you are facing:
I am trying to move some files from a groupfolder in nextcloud to a NFS share and empty the __groupfolder every night.

Steps:

  1. NFS is mounted and writable
  2. Script copies files to NFS share
  3. Script Delete all files in __groupfolder
  4. Script execute occ command to scan specific __groupfolder directory

My problem is that occ file:scan is not working when i try to scan a specific __groupfolder directory β€œocc files:scan --path=”/var/www/ncdata/__groupfolders/2" occ throws me a unknow user error.
When using β€œ/var/www/nextcloud/occ files:scan --all” the __groupfolder is scanned but also all the other directories and i want to avoid that.

/var/www/nextcloud/* user and group is = www-data
/var/www/ncdata/* user and group is = www-data

After expanding my search to the Github page of the Nextcloud Group folder app found the appropriate occ cli commands.

sudo -u www-data php /var/www/nextcloud/occ groupfolders:scan 2


Link: https://github.com/nextcloud/groupfolders

Command line configuration via occ

Group folders can be configured on the command line (cli) using the occ command:

  • occ groupfolders:create <name> β†’ create a group folder
  • occ groupfolders:delete <folder_id> [-f|--force] β†’ delete a group folder and all its contents
  • occ groupfolders:expire β†’ trigger file version expiration (see Nextcloud docs for details)
  • occ groupfolders:group <folder_id> <group_name> [-d|--delete] [write|share|delete] β†’ assign groups and their rights to a group folder
  • occ groupfolders:list β†’ list configured group folders
  • occ groupfolders:permissions β†’ configure advanced permissions (see below for details)
  • occ groupfolders:quota <folder_id> [<quota>|unlimited] β†’ set a quota for a group folder
  • occ groupfolders:rename <folder_id> <name> β†’ rename a group folder
  • occ groupfolders:scan <folder_id> β†’ trigger a filescan for a group folder
2 Likes