Script to move someone else's shared folder

Hello,
I’m about to share many folders with multiple users. I don’t want to clog their root folder with 10+ shares altogether. It would be a lot better if I could dispatch these shares into a couple of parent folders.

This:

** shared_folder1
** shared_folder3
** shared_folder15
** shared_folder26

Becomes this:

  • PARENT1
    ** shared_folder1
    ** shared_folder26
  • PARENT2
    ** shared_folder3
    ** shared_folder15

Is there a way to automate this process ? If yes, how ? APIs, SQL script ?
To clarify :
No I cannot share the PARENT folder directly because it contains subdirs that cannot be shared with these users.
No, I won’t use tags because these folder are mapped from a different server that doesn’t support tag sorting

Hey,

I always recommend this setting which puts all new shares into one defined folder:


(at least the root folder doesn’t get cluttered with shares this way)

Thanks szaimen, this is interesting.
However, that only works if I need just one parent folder. Not good enough for me I’m afraid.

Otherwise, groupfolders are recommended to keep the folderstructure while sharing. But this unfortunately doesn’t solve your problem, either since the files do already exist outside of groupfolders in your example…

I found out this post, where there’s pretty much the same issue.
https://help.nextcloud.com/t/move-shared-file-automatically/55561
I’ll explore this, especially the SQL part.
By the way, is the db schema documented ?