Mass sharing via occ

Hi All

We have a folder structure set up where a parent folder contains 100’s of sub-folders. Each of these sub-folders contains files only the relevant person should see (not edit). We are wondering whether it is possible to do a “mass sharing” via something like the occ command to not have to setup all the privileges via the web UI, by hand? We have the list of users and their details, and we can even write this in bash, nothing fancy. But after a quick look through OCC options, it does not seem like there is a command for setting up shares.

Parent folder
|-> User 1 (Should only be visible to owner of parent and user 1)
|-> User 2 (Should only be visible to owner of parent and user 2)
|-> User N (Should only be visible to owner of parent and user N)

Any help will be appreciated!

Regards

You need to use the sharing API. https://docs.nextcloud.com/server/12/developer_manual/core/ocs-share-api.html