How to set sharing for list of folders/files in the same time?


is there any option to set sharing for more folders in the same time in Nextcloud? I thought I will find some option in documentation ( but I found there only setting ownership via command line, not sharing. If I have 6000 folders and I need to share some of them with one group of users and some other hundreds of them with another user group (I have lists with folder names for every group), can I do it some easy way? Not setting every folder on its own?