[SOLVED] Transfer ownership of individual folder

I have left a group and I want to transfer ownership of the shared folder to a remaining member of the group. It seems that the occ command files:transfer-ownership transfers all files and folders and there is no way to change the ownership of individual files yet, am I right?

1 Like

To make it short:

sudo -u www-data php occ files:transfer-ownership --path=“name of folder” usernamefrom usernameto

If you can specify individual files, you must try yourself.


Oh, really? That must be a new addition then, because everything I found about this command was that it would transfer all files regardless, see Is it possible to change the ownership of one specific file (instead of all)

From your first post, it seems, that all you need is to transfer a Folder. My command above does this and it is tested with NC11. The Folder will be in an generic subfolder, where the new owner may move it to its intenden location. The share itself however is kept alive, and for others who got the folder shared do not notice a thing.

You could also just write the new admin, that he should download and the reupload the Files/Folders needed and share it by himself.

Yes, thanks that was what I was looking for. I just thought that this is not possible with the command…

For those who arrived at this page and are trying to implement the command without success: There is a bug in the script which is preventing it to run succesfully if the path to the folder to be transferred is enclosed in quotes. So the command should be in a form:

sudo -u www-data php occ files:transfer-ownership --path=name_of_folder usernamefrom usernameto

Where: name_of_folder is the name of the folder itself, not the full path. If the files reside in /home/data/usernamefrom/files/thefoldername than you have to specify only the last ‘thefoldername’ part (of course without quotes).

usernamefrom and usernameto are the login names (not the full names)

the command has to be run inside the /var/www/html/nextcloud folder where the occ file resides.