I search an idea for exporting share from a Nextcloud to import them in another Nextcloud.
For now I have a sql request like that to export share initialised by an admin user
select share_type,share_with,password,uid_owner,uid_initiator,item_type,item_source,item_target,file_source,file_target,permissions,accepted,expiration,token,note,hide_download,password_expiration_time from nextcloud.oc_share where uid_initiator='admin'
Does someone have a better idea ? A script to do that ?
If you really only want to migrate share URLs I think your query will export everybody shares once you remove where uid_initiator='admin' from the SQL statement… You can use Configurable Share Links app on the new instance to re-create shares using old links.
@wwe I have to consolidate two Nextcloud in a new one, so I have to export all share for all users in the two nextcloud and change user mapping (bad ad mapping) and integrate them in a new installation.
With occ i can export groupfolders list but not classic share
interesting challenge! if you are looking for internal shares as well I think it will be pretty hard to migrate them. may be the easier approach would be to migrate the data of individual users to the new instance using user migration app and then setup all required internal shares from scratch. maybe worth to look through user-migration-app topics - maybe you can find useful hints.
UPDATE: I’m wondering you are aware of official occ sharing:list command which lists all the shares in the system? (likely the same you get with a SQL query above)
Ok very good I didn’t know this app. So It’s interesting for exporting share but after i can’t recreate them on another nextcloud unless there is an application like sharing:import ?
I don’t think there is general way to import/re-create shares on another system - too many moving parts, user id might change, files and folders have another IDs - mission impossible I would say.